Part Number Hot Search : 
MLG1608 TC531024 MBR360 16TTS AD5624 C3C00 CXXXX MBT412
Product Description
Full Text Search
 

To Download R5F7142 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  revision date: oct. 06, 2008 32 hardware manual renesas 32-bit risc microcompute r superh? risc engine family sh7147 r5f7147 sh7142 R5F7142 rev.3.00 rej09b0230-0300 sh7147 group
rev. 3.00 oct. 06, 2008 page ii of xxiv rej09b0230-0300 1. this document is provided for reference purposes only so that renesas customers may select the appropriate renesas products for their use. renesas neither makes warranties or representations with respect to the accuracy or completeness of the information contained in this document nor g rants any license to any intellectual property ri g hts or any other ri g hts of renesas or any third party with respect to the information in this document. 2. renesas shall have no liability for dama g es or infrin g ement of any intellectual property or other ri g hts arisin g out of the use of any information in this document, includin g , but not limited to, product data, dia g rams, charts, pro g rams, al g orithms, and application circuit examples. 3. you should not use the products or the technolo g y described in this document for the purpose of military applications such as the development of weapons of mass destruction or for the purpose of any other military use. when exportin g the products or technolo g y described herein, you should follow the applicable export control laws and re g ulations, and procedures required by such laws and re g ulations. 4. all information included in this document such as product data, dia g rams, charts, pro g rams, al g orithms, and application circuit examples, is current as of the date this document is issued. such information, however, is subject to chan g e without any prior notice. before purchasin g or usin g any renesas products listed in this document, please confirm the latest product information with a renesas sales office. also, please pay re g ular and careful attention to additional and different information to be disclosed by renesas such as that disclosed throu g h our website. (http://www.renesas.com ) 5. renesas has used reasonable care in compilin g the information included in this document, but renesas assumes no liability whatsoever for any dama g es incurred as a result of errors or omissions in the information included in this document. 6. when usin g or otherwise relyin g on the information in this document, you should evaluate the information in li g ht of the total system before decidin g about the applicability of such information to the intended application. renesas makes no representations, warranties or g uaranties re g ardin g the suitability of its products for any particular application and specifically disclaims any liability arisin g out of the application and use of the information in this document or renesas products. 7. with the exception of products specified by renesas as suitable for automobile applications, renesas products are not desi g ned, manufactured or tested for applications or otherwise in systems the failure or malfunction of which may cause a direct threat to human life or create a risk of human injury or which require especially hi g h quality and reliability such as safety systems, or equipment or systems for transportation and traffic, healthcare, combustion control, aerospace and aeronautics, nuclear power, or undersea communication transmission. if you are considerin g the use of our products for such purposes, please contact a renesas sales office beforehand. renesas shall have no liability for dama g es arisin g out of the uses set forth above. 8. notwithstandin g the precedin g para g raph, you should not use renesas products for the purposes listed below: (1) artificial life support devices or systems (2) sur g ical implantations (3) healthcare intervention (e. g ., excision, administration of medication, etc.) (4) any other purposes that pose a direct threat to human life renesas shall have no liability for dama g es arisin g out of the uses set forth in the above and purchasers who elect to use renesas products in any of the fore g oin g applications shall indemnify and hold harmless renesas technolo g y corp., its affiliated companies and their officers, directors, and employees a g ainst any and all dama g es arisin g out of such applications. 9. you should use the products described herein within the ran g e specified by renesas, especially with respect to the maximum ratin g , operatin g supply volta g e ran g e, movement power volta g e ran g e, heat radiation characteristics, installation and other product characteristics. renesas shall have no liability for malfunctions or dama g es arisin g out of the use of renesas products beyond such specified ran g es. 10. althou g h renesas endeavors to improve the quality and reliability of its products, ic products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. please be sure to implement safety measures to g uard a g ainst the possibility of physical injury, and injury or dama g e caused by fire in the event of the failure of a renesas product, such as safety desi g n for hardware and software includin g but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for a g in g de g radation or any other applicable measures. amon g others, since the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 11. in case renesas products listed in this document are detached from the products to which the renesas products are attached or affixed, the risk of accident such as swallowin g by infants and small children is very hi g h. you should implement safety measures so that renesas products may not be easily detached from your products. renesas shall have no liability for dama g es arisin g out of such detachment. 12. this document may not be reproduced or duplicated, in any form, in whole or in part, without prior written approval from renesas. 13. please contact a renesas sales office if you have any questions re g ardin g the information contained in this document, renesas semiconductor products, or if you have any other inquiries. notes re g ardin g these materials
rev. 3.00 oct. 06, 2008 page iii of xxiv rej09b0230-0300 general precautions in the handling of mpu/mcu products the following usage notes are applicable to all mpu/mcu products from renesas. for detailed usage notes on the products covered by this manual, refer to the relevant sections of the manual. if the descriptions under general precautions in the handling of mpu/mcu products and in the body of the manual differ from each other, the description in the body of the manual takes precedence. 1. handling of unused pins handle unused pins in accord with the directions given under handling of unused pins in the manual. ? the input pins of cmos products are generally in the high-impedance state. in operation with an unused pin in the open-circuit state, extra electromagnetic noise is induced in the vicinity of lsi, an associated shoot-through current flows internally, and malfunctions may occur due to the false recognition of the pin state as an input signal. unused pins should be handled as described under handling of unused pins in the manual. 2. processing at power-on the state of the product is undefined at the moment when power is supplied. ? the states of internal circuits in the lsi are indeterminate and the states of register settings and pins are undefined at the moment when power is supplied. in a finished product where the reset signal is applied to the external reset pin, the states of pins are not guaranteed from the moment when power is supplied until the reset process is completed. in a similar way, the states of pins in a product that is reset by an on-chip power-on reset function are not guaranteed from the moment when power is supplied until the power reaches the level at which resetting has been specified. 3. prohibition of access to reserved addresses access to reserved addresses is prohibited. ? the reserved addresses are provided for the possible future expansion of functions. do not access these addresses; the correct operation of lsi is not guaranteed if they are accessed. 4. clock signals after applying a reset, only release the reset line after the operating clock signal has become stable. when switching the clock signal during program execution, wait until the target clock signal has stabilized. ? when the clock signal is generated with an external resonator (or from an external oscillator) during a reset, ensure that the reset line is only released after full stabilization of the clock signal. moreover, when switching to a clock signal produced with an external resonator (or by an external oscillator) while program execution is in progress, wait until the target clock signal is stable. 5. differences between products before changing from one product to another, i.e. to one with a different type number, confirm that the change will not lead to problems. ? the characteristics of mpu/mcu in the same group but having different type numbers may differ because of the differences in internal memory capacity and layout pattern. when changing to products of different type numbers, implement a system-evaluation test for each of the products.
rev. 3.00 oct. 06, 2008 page iv of xxiv rej09b0230-0300 configuration of this manual this manual comprises the following items: 1. general precautions in the handling of mpu/mcu product 2. configuration of this manual 3. preface 4. contents 5. overview 6. description of functional modules ? cpu and system-control modules ? on-chip peripheral modules the configuration of the functional descrip tion of each module differs according to the module. however, the generic style includes the following items: i) feature ii) input/output pin iii) register description iv) operation v) usage note when designing an application system that includes this lsi, take notes into account. each section includes notes in relation to the descriptions given, and usage notes are given, as required, as the final part of each section. 7. list of registers 8. electrical characteristics 9. appendix 10. main revisions for this edition (only for revised versions) the list of revisions is a summary of points that have been revised or added to earlier versions. this does not include all of the revised contents. for details, see the actual locations in this manual. 11. index
rev. 3.00 oct. 06, 2008 page v of xxiv rej09b0230-0300 preface the sh7147 group risc (reduced instruction set computer) microcomputer includes a renesas technology-original risc cpu as its core, and the peripheral functions required to configure a system. target users: this manual was written for us ers who will be using the sh7147 group in the design of application systems. target users are expected to understand the fundamentals of electrical circuits, logical circuits, and microcomputers. objective: this manual was written to explain the hardware functions and electrical characteristics of the sh7147 group to the target users. refer to the sh-1/sh-2/sh-dsp software manual for a detailed description of the instruction set. notes on reading this manual: ? in order to understand the overall functions of the chip read the manual according to the contents. this manual can be roughly categorized into parts on the cpu, system control functions, peripher al functions and elect rical characteristics. ? in order to understand the details of the cpu's functions read the sh-1/sh-2/sh-dsp software manual. ? in order to understand the details of a register when its name is known read the index that is the final part of the manual to find the page number of the entry on the register. the addresses, bits, and initial values of the registers are summarized in section 24, list of registers. examples: register name: the following notatio n is used for cases when the same or a similar function, e.g. serial communication interface, is implemented on more than one channel: xxx_n (xxx is the register name and n is the channel number) bit order: the msb is on the left and the lsb is on the right. number notation: binary is b'xxxx, hexadecimal is h'xxxx, decimal is xxxx. signal notation: an overbar is added to a low-active signal: xxxx related manuals: the latest versions of all related manuals are available from our web site. please ensure you have the latest versions of all documents you require. http://www.renesas.com/
rev. 3.00 oct. 06, 2008 page vi of xxiv rej09b0230-0300 sh7147 group manuals: document title document no. sh7147 group hardware manual this manual sh-1/sh-2/sh-dsp software manual rej09b0171 user's manuals for development tools: document title document no. superh tm risc engine c/c++ compiler, assembler, optimizing linkage editor compiler package v.9.00 user's manual rej10b0152 superh tm risc engine high-performance embedded workshop 3 user's manual rej10b0025 superh risc engine high-performance embedded workshop 3 tutorial rej10b0023 application note: document title document no. superh risc engine c/c++ compiler package application note rej05b0463 all trademarks and registered trademarks are the property of their respective owners.
rev. 3.00 oct. 06, 2008 page vii of xxiv rej09b0230-0300 contents section 1 overview................................................................................................1 1.1 features....................................................................................................................... .......... 1 1.2 block diagram.................................................................................................................. .... 8 1.3 pin assignments ................................................................................................................ ... 9 1.4 pin functions .................................................................................................................. .... 10 section 2 cpu......................................................................................................17 2.1 features....................................................................................................................... ........ 17 2.2 register configuration........................................................................................................ 1 8 2.2.1 general registers (rn)........................................................................................ 19 2.2.2 control registers ................................................................................................ 19 2.2.3 system registers................................................................................................. 21 2.2.4 initial values of registers................................................................................... 21 2.3 data formats................................................................................................................... .... 22 2.3.1 register data format .......................................................................................... 22 2.3.2 memory data formats ........................................................................................ 22 2.3.3 immediate data formats..................................................................................... 23 2.4 features of instructions....................................................................................................... 23 2.4.1 risc type .......................................................................................................... 23 2.4.2 addressing modes .............................................................................................. 26 2.4.3 instruction formats ............................................................................................. 29 2.5 instruction set ................................................................................................................ ..... 33 2.5.1 instruction set by type....................................................................................... 33 2.5.2 data transfer instructions................................................................................... 37 2.5.3 arithmetic operation instructions ...................................................................... 39 2.5.4 logic operation instructions .............................................................................. 41 2.5.5 shift instructions................................................................................................. 42 2.5.6 branch instructions ............................................................................................. 43 2.5.7 system control instructions................................................................................ 44 2.6 processing states.............................................................................................................. ... 46 section 3 mcu operating modes........................................................................49 3.1 selection of operating modes............................................................................................. 49 3.2 input/output pins.............................................................................................................. .. 50 3.3 operating modes................................................................................................................ .51 3.3.1 mode 0 (mcu exte nsion mode 0) ..................................................................... 51
rev. 3.00 oct. 06, 2008 page viii of xxiv rej09b0230-0300 3.3.2 mode 2 (mcu exte nsion mode 2) ..................................................................... 51 3.3.3 mode 3 (single chip mode) ............................................................................... 51 3.4 address map.................................................................................................................... ... 52 3.5 initial state in this lsi...................................................................................................... .56 3.6 note on changing op erating mode.................................................................................... 56 section 4 clock pulse generator (cpg) ............................................................. 57 4.1 features....................................................................................................................... ........ 57 4.2 input/output pins.............................................................................................................. .. 61 4.3 clock operating mode........................................................................................................ 62 4.4 register descriptions.......................................................................................................... 66 4.4.1 frequency control register (frqcr) ............................................................... 66 4.4.2 oscillation stop det ection control register (osccr) ...................................... 69 4.5 changing frequency........................................................................................................... 70 4.6 oscilla tor ..................................................................................................................... ....... 71 4.6.1 connecting crystal resonator ............................................................................ 71 4.6.2 external clock input method.............................................................................. 72 4.7 function for detecti ng oscillator stop ............................................................................... 73 4.8 usage notes .................................................................................................................... .... 74 4.8.1 note on crystal resonator .................................................................................. 74 4.8.2 notes on board design ....................................................................................... 74 section 5 exception handling ............................................................................. 77 5.1 overview ....................................................................................................................... ..... 77 5.1.1 types of exception handling and priority ......................................................... 77 5.1.2 exception handling operations .......................................................................... 78 5.1.3 exception handling v ector table....................................................................... 79 5.2 resets......................................................................................................................... ......... 81 5.2.1 types of resets................................................................................................... 81 5.2.2 power-on reset .................................................................................................. 81 5.2.3 manual reset ...................................................................................................... 82 5.3 address errors ................................................................................................................. ... 83 5.3.1 address error sources ........................................................................................ 83 5.3.2 address error exception source......................................................................... 84 5.4 interrupts..................................................................................................................... ........ 85 5.4.1 interrupt sources................................................................................................. 85 5.4.2 interrupt priority ................................................................................................. 86 5.4.3 interrupt exception handling ............................................................................. 86 5.5 exceptions triggered by instructions ................................................................................. 87 5.5.1 types of exceptions tri ggered by inst ructions .................................................. 87
rev. 3.00 oct. 06, 2008 page ix of xxiv rej09b0230-0300 5.5.2 trap instructions ................................................................................................. 87 5.5.3 illegal slot instructions ....................................................................................... 88 5.5.4 general illegal instructions................................................................................. 88 5.6 cases when exceptions are accepted................................................................................ 89 5.7 stack states after ex ception handli ng ends ....................................................................... 90 5.8 usage notes .................................................................................................................... .... 92 5.8.1 value of stack pointer (sp) ................................................................................ 92 5.8.2 value of vector base register (vbr) ................................................................ 92 5.8.3 address errors caused by stacking fo r address error exception handling ...... 92 5.8.4 notes on slot illegal instru ction exception handling......................................... 93 section 6 interrupt controller (intc) .................................................................95 6.1 features....................................................................................................................... ........ 95 6.2 input/output pins.............................................................................................................. .. 97 6.3 register descriptions .......................................................................................................... 98 6.3.1 interrupt control register 0 (icr0).................................................................... 99 6.3.2 irq control register (irqcr) ........................................................................ 100 6.3.3 irq status register (irqsr)............................................................................. 101 6.3.4 interrupt priority registers a, d to f, and h to m (ipra, iprd to iprf, and iprh to iprm)...................................................... 104 6.4 interrupt sources.............................................................................................................. . 107 6.4.1 external interrupts ............................................................................................ 107 6.4.2 on-chip peripheral mo dule interrupts ............................................................. 108 6.4.3 user break interrupt ......................................................................................... 108 6.5 interrupt exception handling vector table...................................................................... 109 6.6 interrupt operation ........................................................................................................... 1 13 6.6.1 interrupt sequence ............................................................................................ 113 6.6.2 stack after interrupt exception handling ......................................................... 116 6.7 interrupt res ponse time................................................................................................... 116 6.8 data transfer with interrupt request signals ................................................................... 118 6.8.1 handling interrupt request signals as sources for dtc activation and cpu interrupts .................................................................................................. 119 6.8.2 handling interrupt request signals as sources for dtc activation, but not cpu interrupts .................................................................................................. 119 6.8.3 handling interrupt request signals as sources for cpu interrupts, but not dtc activation................................................................................................. 120 6.9 usage note..................................................................................................................... ... 120
rev. 3.00 oct. 06, 2008 page x of xxiv rej09b0230-0300 section 7 user break controller (ubc)............................................................ 121 7.1 features....................................................................................................................... ...... 121 7.2 input/output pins.............................................................................................................. 123 7.3 register descriptions........................................................................................................ 12 4 7.3.1 break address register a (bara) .................................................................. 125 7.3.2 break address mask register a (bamra)..................................................... 125 7.3.3 break bus cycle register a (bbra)............................................................... 126 7.3.4 break data register a (bdra) ....................................................................... 128 7.3.5 break data mask register a (bdmra) .......................................................... 129 7.3.6 break address register b (barb) .................................................................. 130 7.3.7 break address mask register b (bamrb) ..................................................... 131 7.3.8 break data register b (bdrb) ........................................................................ 132 7.3.9 break data mask register b (bdmrb)........................................................... 133 7.3.10 break bus cycle register b (bbrb) ............................................................... 134 7.3.11 break control register (brcr) ....................................................................... 136 7.3.12 execution times break register (betr)......................................................... 141 7.3.13 branch source register (brsr)....................................................................... 142 7.3.14 branch destination register (brdr)............................................................... 143 7.4 operation ...................................................................................................................... .... 144 7.4.1 flow of the user break operation .................................................................... 144 7.4.2 user break on instruction fetch cycle ............................................................. 145 7.4.3 break on data access cycle............................................................................. 146 7.4.4 sequential break ............................................................................................... 147 7.4.5 value of saved program counter ..................................................................... 147 7.4.6 pc trace ........................................................................................................... 148 7.4.7 usage examples................................................................................................ 149 7.5 usage notes .................................................................................................................... .. 154 section 8 data transfer controller (dtc)........................................................ 157 8.1 features....................................................................................................................... ...... 157 8.2 register descriptions........................................................................................................ 15 9 8.2.1 dtc mode register a (mra) ......................................................................... 160 8.2.2 dtc mode register b (mrb).......................................................................... 161 8.2.3 dtc source address register (sar)............................................................... 163 8.2.4 dtc destination address register (dar)....................................................... 163 8.2.5 dtc transfer count register a (cra) ........................................................... 164 8.2.6 dtc transfer count re gister b (crb)............................................................ 165 8.2.7 dtc enable registers a to e (dtcera to dtcere) ................................... 166 8.2.8 dtc control register (dtccr) ...................................................................... 167
rev. 3.00 oct. 06, 2008 page xi of xxiv rej09b0230-0300 8.2.9 dtc vector base register (dtcvbr) ............................................................ 168 8.2.10 bus function extending register (bscehr) .................................................. 168 8.3 activation sources............................................................................................................ 1 69 8.4 location of transfer informat ion and dtc vector table ................................................ 169 8.5 operation ...................................................................................................................... .... 174 8.5.1 transfer information read skip function ........................................................ 179 8.5.2 transfer information write -back skip function............................................... 180 8.5.3 normal transfer mode ..................................................................................... 180 8.5.4 repeat transfer mode....................................................................................... 181 8.5.5 block transfer mode ........................................................................................ 183 8.5.6 chain transfer .................................................................................................. 184 8.5.7 operation timing.............................................................................................. 186 8.5.8 number of dtc execution cycles ................................................................... 187 8.5.9 dtc bus release timing ................................................................................. 189 8.5.10 dtc activation priority order ......................................................................... 191 8.6 dtc activation by interrupt............................................................................................. 192 8.7 examples of use of the dtc ............................................................................................ 193 8.7.1 normal transfer mode ..................................................................................... 193 8.7.2 chain transfer when transfer counter = 0 ...................................................... 193 8.8 interrupt sources.............................................................................................................. . 195 8.9 usage notes .................................................................................................................... .. 196 8.9.1 module standby mode setting ......................................................................... 196 8.9.2 on-chip ram .................................................................................................. 196 8.9.3 dtce bit setting.............................................................................................. 196 8.9.4 chain transfer .................................................................................................. 196 8.9.5 transfer information start address, source address, and destination address .......................................................................................... 196 8.9.6 access to dtc registers through dtc ............................................................ 196 8.9.7 notes on irq interrupt as dtc activation source .......................................... 197 8.9.8 note on sci as dtc activation sources.......................................................... 197 8.9.9 clearing interrupt source flag.......................................................................... 197 8.9.10 conflict between nmi interrupt and dtc activation ...................................... 197 8.9.11 operation when dtc activation request is accepted.................................... 198 section 9 bus state controller (bsc)................................................................199 9.1 features....................................................................................................................... ...... 199 9.2 input/output pins.............................................................................................................. 201 9.3 area overview.................................................................................................................. 202 9.3.1 area division.................................................................................................... 202 9.3.2 address map ..................................................................................................... 202
rev. 3.00 oct. 06, 2008 page xii of xxiv rej09b0230-0300 9.4 register descriptions........................................................................................................ 20 7 9.4.1 common control register (cmncr) .............................................................. 207 9.4.2 csn space bus control register (csnbcr) (n = 0 and 1) .............................. 209 9.4.3 csn space wait control register (csnwcr) (n = 0 and 1)............................ 212 9.4.4 bus function extending register (bscehr) .................................................. 214 9.5 operation ...................................................................................................................... .... 215 9.5.1 endian/access size and data alignment.......................................................... 215 9.5.2 normal space interface..................................................................................... 216 9.5.3 access wait control ......................................................................................... 219 9.5.4 csn assert period extension ............................................................................ 221 9.5.5 wait between access cycles ............................................................................ 222 9.5.6 bus arbitration ................................................................................................. 224 9.5.7 others................................................................................................................ 230 9.5.8 access to on-chip flash and on-chip ram by cpu ................................. 231 9.5.9 access to on-chip periphera l i/o registers by cpu ....................................... 231 section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) ....................................................... 235 10.1 features....................................................................................................................... ...... 235 10.2 input/output pins.............................................................................................................. 246 10.3 register descriptions........................................................................................................ 24 8 10.3.1 timer control register (tcr).......................................................................... 255 10.3.2 timer mode register (tmdr)......................................................................... 259 10.3.3 timer i/o control register (tior) .................................................................. 262 10.3.4 timer compare match clear register (tcntcmpclr) ................................ 281 10.3.5 timer interrupt enable register (tier)........................................................... 282 10.3.6 timer status register (tsr)............................................................................. 287 10.3.7 timer buffer operation transfer mode register (tbtm)............................... 294 10.3.8 timer input capture control register (ticcr) ............................................... 295 10.3.9 timer synchronous clear register (tsycr)................................................... 297 10.3.10 timer a/d converter start request control register (tadcr) ..................... 299 10.3.11 timer a/d converter start request cycle set registers (tadcora_4 and tadcorb_4).................................................................. 302 10.3.12 timer a/d converter start request cycle set buffer registers (tadcobra_4 and tadcobrb_4) ............................................................ 302 10.3.13 timer counter (tcnt)..................................................................................... 303 10.3.14 timer general register (tgr) ......................................................................... 303 10.3.15 timer start register (tstr) ............................................................................ 304 10.3.16 timer synchronous register (tsyr)............................................................... 306 10.3.17 timer counter synchronous st art register (tcsystr) ................................. 308
rev. 3.00 oct. 06, 2008 page xiii of xxiv rej09b0230-0300 10.3.18 timer read/write enable register (trwer).................................................. 311 10.3.19 timer output master enable register (toer) ................................................ 312 10.3.20 timer output control re gister 1 (tocr1) ...................................................... 313 10.3.21 timer output control re gister 2 (tocr2) ...................................................... 316 10.3.22 timer output level buffer register (tolbr) ................................................ 319 10.3.23 timer gate control register (tgcr)............................................................... 320 10.3.24 timer subcounter (tcnts) ............................................................................. 322 10.3.25 timer dead time data register (tddr)......................................................... 323 10.3.26 timer cycle data register (tcdr) ................................................................. 323 10.3.27 timer cycle buffer register (tcbr)............................................................... 324 10.3.28 timer interrupt skipping set register (titcr) ............................................... 324 10.3.29 timer interrupt skipping counter (titcnt)................................................... 326 10.3.30 timer buffer transfer set register (tbter) .................................................. 327 10.3.31 timer dead time enable register (tder)...................................................... 329 10.3.32 timer waveform control register (twcr) .................................................... 330 10.3.33 bus master interface ......................................................................................... 332 10.4 operation ...................................................................................................................... .... 333 10.4.1 basic functions................................................................................................. 333 10.4.2 synchronous op eration..................................................................................... 339 10.4.3 buffer operation ............................................................................................... 341 10.4.4 cascaded operation .......................................................................................... 345 10.4.5 pwm modes ..................................................................................................... 350 10.4.6 phase counting mode ....................................................................................... 355 10.4.7 reset-synchronized pwm mode...................................................................... 362 10.4.8 complementary pwm mode ............................................................................ 365 10.4.9 a/d converter start request delaying function.............................................. 409 10.4.10 mtu2?mtu2s synchronous operation.......................................................... 413 10.4.11 external pulse width measurement.................................................................. 419 10.4.12 dead time compensation................................................................................. 420 10.4.13 tcnt capture at crest and/or trough in complementary pwm operation ... 422 10.5 interrupt sources.............................................................................................................. . 423 10.5.1 interrupt sources and priorities......................................................................... 423 10.5.2 dtc activation................................................................................................. 425 10.5.3 a/d converter activation................................................................................. 426 10.6 operation timing.............................................................................................................. 4 28 10.6.1 input/output timing ......................................................................................... 428 10.6.2 interrupt signal timing..................................................................................... 435 10.7 usage notes .................................................................................................................... .. 440 10.7.1 module standby mode setting ......................................................................... 440 10.7.2 input clock re strictions ................................................................................... 440
rev. 3.00 oct. 06, 2008 page xiv of xxiv rej09b0230-0300 10.7.3 caution on period setting ................................................................................. 441 10.7.4 contention between tcnt write and clear operations.................................. 441 10.7.5 contention between tcnt write and increment operations........................... 442 10.7.6 contention between tgr write and compare match ...................................... 443 10.7.7 contention between buffer regist er write and compare match ..................... 444 10.7.8 contention between buffer register write and tcnt clear ........................... 445 10.7.9 contention between tgr read and input capture........................................... 446 10.7.10 contention between tgr write and input capture.......................................... 447 10.7.11 contention between buffer regist er write and input capture ......................... 448 10.7.12 tcnt_2 write and overflow/underflow contention in cascade connection........................................................................................................ 448 10.7.13 counter value during comple mentary pwm mode stop ................................ 450 10.7.14 buffer operation setting in complementary pwm mode ............................... 450 10.7.15 reset sync pwm mode buffer operation and compare match flag .............. 451 10.7.16 overflow flags in reset synchronous pwm mode ......................................... 452 10.7.17 contention between overflow/underflow and counter clearing..................... 453 10.7.18 contention between tcnt write and overflow/underflow............................ 454 10.7.19 cautions on transition from normal operation or pwm mode 1 to reset-synchronized pwm mode...................................................................... 454 10.7.20 output level in complementary pwm mode and reset-synchronized pwm mode ...................................................................................................... 455 10.7.21 interrupts in m odule standby mode ................................................................. 455 10.7.22 simultaneous capture of tcnt_1 and tcnt_2 in cascade connection........ 455 10.7.23 buffer register flag bits in complementary pwm mode............................... 455 10.8 mtu2 output pin initialization........................................................................................ 456 10.8.1 operating modes............................................................................................... 456 10.8.2 reset start operation ........................................................................................ 456 10.8.3 operation in case of re-setting due to error during operation, etc............... 457 10.8.4 overview of initialization procedures and mode transitions in case of error during operation, etc. .............................................................................. 458 section 11 port output enable (poe) ............................................................... 489 11.1 features....................................................................................................................... ...... 489 11.2 input/output pins.............................................................................................................. 490 11.3 register descriptions........................................................................................................ 49 2 11.3.1 input level control/statu s register 1 (icsr1) ................................................ 493 11.3.2 output level control/statu s register 1 (ocsr1) ............................................ 496 11.3.3 input level control/statu s register 2 (icsr2) ................................................ 498 11.3.4 output level control/statu s register 2 (ocsr2) ............................................ 501 11.3.5 input level control/statu s register 3 (icsr3) ................................................ 503
rev. 3.00 oct. 06, 2008 page xv of xxiv rej09b0230-0300 11.3.6 software port output enab le register (spoer) .............................................. 505 11.3.7 port output enable contro l register 1 (poecr1) ........................................... 506 11.3.8 port output enable contro l register 2 (poecr2) ........................................... 508 11.4 operation ...................................................................................................................... .... 511 11.4.1 input level detec tion operation....................................................................... 512 11.4.2 output-level compare operation .................................................................... 513 11.4.3 release from high-impedance state................................................................. 514 11.5 interrupts..................................................................................................................... ...... 515 11.6 usage note..................................................................................................................... ... 515 11.6.1 pin state when a power-on reset is issued from the watchdog timer ........... 515 section 12 watc hdog timer (wdt)..................................................................517 12.1 features....................................................................................................................... ...... 517 12.2 input/output pin for wdt................................................................................................ 519 12.3 register descriptions ........................................................................................................ 52 0 12.3.1 watchdog timer coun ter (wtcnt)................................................................ 520 12.3.2 watchdog timer control/statu s register (wtcsr)........................................ 521 12.3.3 notes on register access.................................................................................. 523 12.4 operation ...................................................................................................................... .... 524 12.4.1 revoking software standbys ............................................................................ 524 12.4.2 using watchdog ti mer mode........................................................................... 524 12.4.3 using interval timer mode............................................................................... 525 12.5 usage note..................................................................................................................... ... 526 12.5.1 wtcnt setting value ..................................................................................... 526 section 13 serial communication interface (sci) ............................................527 13.1 features....................................................................................................................... ...... 527 13.2 input/output pins.............................................................................................................. 529 13.3 register descriptions ........................................................................................................ 53 0 13.3.1 receive shift register (scrsr)....................................................................... 531 13.3.2 receive data register (scrdr) ...................................................................... 531 13.3.3 transmit shift regi ster (sctsr) ..................................................................... 531 13.3.4 transmit data register (sctdr)..................................................................... 532 13.3.5 serial mode register (scsmr)........................................................................ 532 13.3.6 serial control regi ster (scscr)...................................................................... 535 13.3.7 serial status regi ster (scssr)......................................................................... 538 13.3.8 serial port regi ster (scsptr) ......................................................................... 544 13.3.9 serial direction contro l register (scsdcr)................................................... 546 13.3.10 bit rate register (scbrr)............................................................................... 547
rev. 3.00 oct. 06, 2008 page xvi of xxiv rej09b0230-0300 13.4 operation ...................................................................................................................... .... 558 13.4.1 overview........................................................................................................... 558 13.4.2 operation in async hronous mode .................................................................... 560 13.4.3 clock synchro nous mo de................................................................................. 570 13.4.4 multiprocessor communication function ........................................................ 579 13.4.5 multiprocessor serial da ta transmission ......................................................... 581 13.4.6 multiprocessor serial data reception .............................................................. 582 13.5 sci interrupt sources and dtc........................................................................................ 585 13.6 serial port register (s csptr) and sci pins ................................................................... 586 13.7 usage notes .................................................................................................................... .. 588 13.7.1 sctdr writing and tdre flag...................................................................... 588 13.7.2 multiple receive error occurrence .................................................................. 588 13.7.3 break detection and processing ....................................................................... 589 13.7.4 sending a break signal..................................................................................... 589 13.7.5 receive data sampling timi ng and receive margin (asynchronous mode) ...................................................................................... 589 13.7.6 note on using dtc .......................................................................................... 591 13.7.7 note on using external clock in clock synchr onous m ode............................ 591 13.7.8 module standby mode setting ......................................................................... 591 section 14 synchronous se rial communication unit ....................................... 593 14.1 features....................................................................................................................... ...... 593 14.2 input/output pins.............................................................................................................. 595 14.3 register descriptions........................................................................................................ 59 6 14.3.1 ss control register h (sscrh) ...................................................................... 597 14.3.2 ss control register l (sscrl) ....................................................................... 599 14.3.3 ss mode register (ssmr) ............................................................................... 600 14.3.4 ss enable register (sser) .............................................................................. 602 14.3.5 ss status regist er (sssr) ................................................................................ 603 14.3.6 ss control register 2 (sscr2) ........................................................................ 606 14.3.7 ss transmit data registers 0 to 3 (sstdr0 to sstdr3)............................... 607 14.3.8 ss receive data registers 0 to 3 (ssrdr0 to ssrdr3)................................ 608 14.3.9 ss shift register (sstrsr)............................................................................. 609 14.4 operation ...................................................................................................................... .... 610 14.4.1 transfer clock .................................................................................................. 610 14.4.2 relationship of clock phase, polarity, and data .............................................. 610 14.4.3 relationship between data input/out put pins and shift register .................... 611 14.4.4 communication modes a nd pin functions ....................................................... 613 14.4.5 synchronous serial communicati on mode ...................................................... 615 14.4.6 scs pin control and conflict error.................................................................. 624
rev. 3.00 oct. 06, 2008 page xvii of xxiv rej09b0230-0300 14.4.7 clock synchronous co mmunication mode ...................................................... 626 14.5 synchronous serial communication un it interrupt sources and dtc............................. 632 14.6 usage notes .................................................................................................................... .. 633 14.6.1 module standby mode setting ......................................................................... 633 14.6.2 access to sstdr and ssrdr registers.......................................................... 633 14.6.3 continuous transmission/reception in synchronous serial communica tion slave mode .................................................................. 633 section 15 a/d converter (adc)......................................................................635 15.1 features....................................................................................................................... ...... 635 15.2 input/output pins.............................................................................................................. 637 15.3 register descriptions ........................................................................................................ 63 8 15.3.1 a/d control registers_0 a nd _1 (adcr_0 a nd adcr_1).............................. 639 15.3.2 a/d status registers_0 and _1 (adsr_0 and adsr_1)................................. 642 15.3.3 a/d start trigger select registers_0 and _1 (adstrgr_0 and adstrgr_1) ................................................................... 643 15.3.4 a/d analog input channel select registers_0 and _1 (adansr_0 and adansr_1) ....................................................................... 645 15.3.5 a/d data registers 0 to 15 (addr0 to addr15) .......................................... 646 15.3.6 cpu interface ................................................................................................... 647 15.4 operation ...................................................................................................................... .... 648 15.4.1 single-cycle scan mode................................................................................... 648 15.4.2 continuous s can mode ..................................................................................... 650 15.4.3 input sampling and a/ d conversi on time ....................................................... 652 15.4.4 a/d converter activation by mtu2 and mtu2s ........................................... 654 15.4.5 external trigger input ti ming.......................................................................... 655 15.4.6 example of addr auto-clear function.......................................................... 655 15.5 interrupt sources and dtc transfer requests ................................................................. 657 15.6 definitions of a/d c onversion accuracy......................................................................... 658 15.7 usage notes .................................................................................................................... .. 660 15.7.1 analog input voltage range............................................................................. 660 15.7.2 relationship between avcc, avss and vcc, vss ............................................. 660 15.7.3 range of av refh and av refl pin settings.............................................................. 660 15.7.4 notes on board design ..................................................................................... 660 15.7.5 notes on noise c ountermeasures ..................................................................... 660 15.7.6 notes on register setting.................................................................................. 661 section 16 compare match timer (cmt).........................................................663 16.1 features....................................................................................................................... ...... 663
rev. 3.00 oct. 06, 2008 page xviii of xxiv rej09b0230-0300 16.2 register descriptions........................................................................................................ 66 4 16.2.1 compare match timer start register (cmstr) .............................................. 665 16.2.2 compare match timer control/status register (cmcsr) .............................. 665 16.2.3 compare match counter (cmcnt) ................................................................. 667 16.2.4 compare match constant register (cmcor) ................................................. 667 16.3 operation ...................................................................................................................... .... 668 16.3.1 interval count operation .................................................................................. 668 16.3.2 cmcnt count timing..................................................................................... 668 16.4 interrupts..................................................................................................................... ...... 669 16.4.1 cmt interrupt sources and dtc activation.................................................... 669 16.4.2 timing of setting compare match flag ........................................................... 669 16.4.3 timing of clearing compare match flag......................................................... 669 16.5 usage notes .................................................................................................................... .. 670 16.5.1 module standby mode setting ......................................................................... 670 16.5.2 conflict between write and compare-match processes of cmcnt ............... 670 16.5.3 conflict between word-write and count-up processes of cmcnt ............... 671 16.5.4 conflict between byte-write and count-up processes of cmcnt................. 672 16.5.5 compare match between cmcnt and cmcor ............................................. 672 section 17 controller area network (rcan-et) ............................................ 673 17.1 summary........................................................................................................................ ... 673 17.1.1 overview........................................................................................................... 673 17.1.2 scope ................................................................................................................ 673 17.1.3 audience ........................................................................................................... 673 17.1.4 references......................................................................................................... 674 17.1.5 features............................................................................................................. 674 17.2 architecture ................................................................................................................... ... 675 17.3 programming model - overview ...................................................................................... 678 17.3.1 memory map .................................................................................................... 678 17.3.2 mailbox structure ............................................................................................. 679 17.3.3 rcan-et control registers ............................................................................ 687 17.3.4 rcan-et mailbox registers........................................................................... 706 17.4 application note............................................................................................................... 716 17.4.1 test mode settings ........................................................................................... 716 17.4.2 configuration of rcan-et ............................................................................. 717 17.4.3 message transmission sequence...................................................................... 723 17.4.4 message receive sequence .............................................................................. 726 17.4.5 reconfiguration of mailbox.............................................................................. 728 17.5 interrupt sources.............................................................................................................. . 730 17.6 dtc interface .................................................................................................................. . 731
rev. 3.00 oct. 06, 2008 page xix of xxiv rej09b0230-0300 17.7 can bus interface............................................................................................................ 73 2 17.8 usage notes .................................................................................................................... .. 733 17.8.1 module stop mode ........................................................................................... 733 17.8.2 reset ................................................................................................................. 733 17.8.3 can sleep mode.............................................................................................. 733 17.8.4 register access................................................................................................. 733 17.8.5 interrupts........................................................................................................... 734 section 18 pin function controller (pfc).........................................................735 18.1 register descriptions ........................................................................................................ 74 6 18.1.1 port a i/o register l (paiorl)...................................................................... 747 18.1.2 port a control registers l1 to l4 (pacrl1 to pacrl4).............................. 748 18.1.3 port b i/o register l (pbiorl) ...................................................................... 756 18.1.4 port b control registers l1 , l2 (pbcrl 1, pbcrl2)..................................... 757 18.1.5 port d i/o register l (pdiorl)...................................................................... 761 18.1.6 port d control registers l1 to l3 (pdcrl1 to pdcrl3).............................. 762 18.1.7 port e i/o registers l, h (peiorl, peiorh) ................................................ 767 18.1.8 port e control registers l1 to l4, h1, h2 (pecrl1 to pecrl4, pecrh1, pecrh2) .................................................... 768 18.2 usage notes .................................................................................................................... .. 777 section 19 i/o ports ...........................................................................................779 19.1 port a......................................................................................................................... ....... 780 19.1.1 register descriptions ........................................................................................ 781 19.1.2 port a data register l (padrl) ..................................................................... 781 19.1.3 port a port regist er l (paprl)....................................................................... 783 19.2 port b ......................................................................................................................... ....... 784 19.2.1 register descriptions ........................................................................................ 784 19.2.2 port b data register l (pbdrl) ..................................................................... 785 19.2.3 port b port register l (pbprl) ....................................................................... 786 19.3 port d......................................................................................................................... ....... 787 19.3.1 register descriptions ........................................................................................ 787 19.3.2 port d data register l (pddrl) ..................................................................... 788 19.3.3 port d port regist er l (pdprl)....................................................................... 790 19.4 port e ......................................................................................................................... ....... 791 19.4.1 register descriptions ........................................................................................ 792 19.4.2 port e data registers h and l (pedrh and pedrl) ..................................... 792 19.4.3 port e port registers h a nd l (peprh and peprl) ....................................... 795
rev. 3.00 oct. 06, 2008 page xx of xxiv rej09b0230-0300 section 20 flash memory.................................................................................. 797 20.1 features....................................................................................................................... ...... 797 20.2 overview ....................................................................................................................... ... 799 20.2.1 block diagram.................................................................................................. 799 20.2.2 operating mode ................................................................................................ 800 20.2.3 mode comparison............................................................................................. 802 20.2.4 flash memory configuration............................................................................ 803 20.2.5 block division .................................................................................................. 804 20.2.6 programming/erasing interface ........................................................................ 805 20.3 input/output pins.............................................................................................................. 808 20.4 register descriptions........................................................................................................ 80 8 20.4.1 registers ........................................................................................................... 808 20.4.2 programming/erasing interface registers ........................................................ 811 20.4.3 programming/erasing interface parameters ..................................................... 818 20.4.4 ram emulation register (ramer)................................................................ 833 20.5 on-board programming mode ......................................................................................... 835 20.5.1 boot m ode ........................................................................................................ 835 20.5.2 user program mode.......................................................................................... 839 20.5.3 user boot mode................................................................................................ 850 20.6 protection..................................................................................................................... ..... 855 20.6.1 hardware protection ......................................................................................... 855 20.6.2 software protection........................................................................................... 856 20.6.3 error protection................................................................................................. 856 20.7 flash memory emulation in ram ................................................................................... 858 20.8 usage notes .................................................................................................................... .. 861 20.8.1 switching between user mat and user boot mat........................................ 861 20.8.2 interrupts during programming/erasing ........................................................... 862 20.8.3 other notes....................................................................................................... 864 20.9 supplementary in formation .............................................................................................. 867 20.9.1 specifications of the standard serial communications interface in boot mode................................................................................................................. 867 20.9.2 areas for storage of the procedural program and data for programming........ 897 20.10 programmer mode ............................................................................................................ 904 section 21 ram ................................................................................................ 905 21.1 usage notes .................................................................................................................... .. 906 21.1.1 module standby mode setting ......................................................................... 906 21.1.2 address error.................................................................................................... 906 21.1.3 initial values in ram....................................................................................... 906
rev. 3.00 oct. 06, 2008 page xxi of xxiv rej09b0230-0300 section 22 power-down modes ........................................................................907 22.1 features....................................................................................................................... ...... 907 22.1.1 types of power-down modes .......................................................................... 907 22.2 input/output pins.............................................................................................................. 909 22.3 register descriptions ........................................................................................................ 91 0 22.3.1 standby control regist er 1 (stb cr1) ............................................................. 910 22.3.2 standby control regist er 2 (stb cr2) ............................................................. 911 22.3.3 standby control regist er 3 (stb cr3) ............................................................. 912 22.3.4 standby control regist er 4 (stb cr4) ............................................................. 914 22.3.5 standby control regist er 5 (stb cr5) ............................................................. 915 22.3.6 standby control regist er 6 (stb cr6) ............................................................. 916 22.3.7 ram control register (ramcr) .................................................................... 917 22.4 sleep mode ..................................................................................................................... .. 918 22.4.1 transition to sleep mode.................................................................................. 918 22.4.2 canceling sleep mode ...................................................................................... 918 22.5 software st andby m ode.................................................................................................... 919 22.5.1 transition to software standby mode .............................................................. 919 22.5.2 canceling software standby mode................................................................... 920 22.6 deep software standby mode .......................................................................................... 921 22.6.1 transition to deep so ftware sta ndby mode ..................................................... 921 22.6.2 canceling deep soft ware sta ndby mode ......................................................... 921 22.7 module standb y mode ...................................................................................................... 922 22.7.1 transition to module standby mode ................................................................ 922 22.7.2 canceling module st andby function................................................................ 922 22.8 hardware standby mode .................................................................................................. 923 22.8.1 transition to hardware standby mode ............................................................. 923 22.8.2 clearing hardware standby mode.................................................................... 923 22.8.3 hardware standby mode ti ming...................................................................... 923 22.9 usage note..................................................................................................................... ... 924 22.9.1 current consumption while waiting fo r oscillation to be stabilized............... 924 22.9.2 executing the sleep instruction ..................................................................... 924 section 23 advanced user debugg er (aud)....................................................925 23.1 features....................................................................................................................... ...... 925 23.2 input/output pins.............................................................................................................. 927 23.2.1 description of common pins............................................................................ 927 23.2.2 description of pins in branch trace mode....................................................... 928 23.2.3 description of pins in ram monitor mode ..................................................... 928 23.3 branch trace mode........................................................................................................... 929 23.3.1 register descriptions ........................................................................................ 929
rev. 3.00 oct. 06, 2008 page xxii of xxiv rej09b0230-0300 23.3.2 aud control register (aucsr) ..................................................................... 929 23.3.3 aud window a start address register (auwasr)...................................... 933 23.3.4 aud window a end address register (auwaer) ...................................... 933 23.3.5 aud window b start address register (auwbsr) ...................................... 934 23.3.6 aud window b end address register (auwber)....................................... 934 23.3.7 aud extended control register (auecsr) ................................................... 935 23.3.8 operation .......................................................................................................... 937 23.3.9 usage notes (branch trace mode)................................................................... 947 23.4 ram monito r mode ......................................................................................................... 949 23.4.1 communication protocol .................................................................................. 949 23.4.2 operation .......................................................................................................... 949 23.4.3 usage notes (ram monitor mode) ................................................................. 951 section 24 list of registers............................................................................... 953 24.1 register address table (in the order of addresses) ........................................................ 954 24.2 register bit list .............................................................................................................. .. 982 24.3 register states in e ach operati ng mode ........................................................................ 1004 section 25 electrical characteristics ............................................................... 1019 25.1 absolute maxi mum rati ngs ........................................................................................... 1019 25.2 dc character istics .......................................................................................................... 102 0 25.3 ac character istics .......................................................................................................... 102 5 25.3.1 clock ti ming .................................................................................................. 1026 25.3.2 control signa l timing .................................................................................... 1029 25.3.3 ac bus timing............................................................................................... 1032 25.3.4 multi function timer pulse unit 2 (mtu2) timing...................................... 1038 25.3.5 multi function timer pulse un it 2s (mtu2s) timing ................................. 1040 25.3.6 i/o port timing............................................................................................... 1041 25.3.7 watchdog timer (w dt) timi ng.................................................................... 1042 25.3.8 serial communication inte rface (sci) timing............................................... 1043 25.3.9 synchronous serial comm unication unit timing.......................................... 1045 25.3.10 controller area network (rcan-et) timing............................................... 1049 25.3.11 port output enable (poe) timing.................................................................. 1050 25.3.12 ubc trigger timing ...................................................................................... 1051 25.3.13 a/d converter timing.................................................................................... 1052 25.3.14 aud timing................................................................................................... 1053 25.3.15 ac characteristics measurement conditions ................................................. 1056 25.4 a/d converter characteristics........................................................................................ 1057 25.5 flash memory characteristics ........................................................................................ 1058
rev. 3.00 oct. 06, 2008 page xxiii of xxiv rej09b0230-0300 25.6 usage note..................................................................................................................... . 1059 25.6.1 notes on connecting v cl capacitor ................................................................ 1059 appendix............................................................................................................1061 a. pin states ..................................................................................................................... ... 1061 b. pin states of bus related signals ................................................................................... 1066 c. list of part number ........................................................................................................ 1067 d. package dime nsions ....................................................................................................... 1068 main revisions for this edition........................................................................1069 index ..................................................................................................................1071
rev. 3.00 oct. 06, 2008 page xxiv of xxiv rej09b0230-0300
section 1 overview rev. 3.00 oct. 06, 2008 page 1 of 1080 rej09b0230-0300 section 1 overview 1.1 features this lsi is a single-chip risc (reduced instruction set computer) microcomputer that integrates a renesas technology original risc cpu core with peripheral functions required for system configuration. the cpu in this lsi has a risc-type instruction set. most instructions can be executed in one state (one system clock cycle), which greatly im proves instruction execu tion speed. in addition, the 32-bit internal-bus architecture enhances data processing power. with this cpu, it has become possible to assemble low-cost, high-performance, and high-functioning systems, even for applications that were previously impossible w ith microcomputers, such as real-time control, which demands high speeds. in addition, this lsi includes on-chip peripheral functions necessary for system configuration, such as large-capacity rom and ram, a data transfer controller (dtc), timers, a serial communication interface (sci), a synchronous seri al communication unit, an a/d converter, an interrupt controller (intc), i/o ports, and controller area network (rcan-et). this lsi also provides an external memory access support function to enable direct connection to various memory devices or peripheral lsis. these on-chip functions significantly reduce costs of designing and manufacturing application systems. the version of on-chip rom is f-ztat tm (flexible zero turn around time)* that includes flash memory. the flash memory can be programmed with a programmer that supports programming of this lsi, and can also be programmed and erased by software. this enables lsi chip to be re- programmed at a user-site while mounted on a board. the features of this lsi are listed in table 1.1. note: * f-ztat tm is a trademark of renesas technology corp.
section 1 overview rev. 3.00 oct. 06, 2008 page 2 of 1080 rej09b0230-0300 ? product lineup power supply voltage part no. rom ram no. of channels in can operating temperature maximum operating frequency vcc pvcc avcc r5f71474bj80fpv r5f71474bd80fpv 16 kb ? 40 to + 85 c 80 mhz 5.0 0.5 v r5f71474ak64fpv 256 kb 12 kb ? 40 to + 125 c 64 mhz 3.3 0.3 v r5f71475bj80fpv ? 40 to + 85 c 80 mhz 5.0 0.5 v r5f71475ak64fpv 384 kb ? 40 to + 125 c 64 mhz 3.3 0.3 v r5f71476bj80fpv r5f71476bd80fpv ? 40 to + 85 c 80 mhz 5.0 0.5 v r5f71476ak64fpv 512 kb 1 ch ? 40 to + 125 c 64 mhz 3.3 0.3 v R5F71424bj80fpv 16 kb ? 40 to + 85 c 80 mhz 5.0 0.5 v R5F71424ak64fpv 256 kb 12 kb ? 40 to + 125 c 64 mhz 3.3 0.3 v R5F71426bj80fpv R5F71426bd80fpv 512 kb 16 kb 2 ch ? 40 to + 85 c 80 mhz 5.0 0.5 v 5.0 0.5 v 5.0 0.5 v R5F71426ak64fpv ? 40 to + 125 c 64 mhz 3.3 0.3 v ? i/o ports i/o pins input-only pins 57 16 ? package package package code body size pin pitch lqfp-100 fp-100uv 14.0 14.0 mm 0.5 mm
section 1 overview rev. 3.00 oct. 06, 2008 page 3 of 1080 rej09b0230-0300 table 1.1 features items specification cpu ? central processing unit with an internal 32-bit risc (reduced instruction set computer) architecture ? instruction length: 16-bit fixed length for improved code efficiency ? load-store architecture (basic operations are executed between registers) ? sixteen 32-bit general registers ? five-stage pipeline ? on-chip multiplier: multiplication operations (32 bits 32 bits 64 bits) executed in two to five cycles ? c language-oriented 62 basic instructions note: some specifications on slot illegal instruction exception handling in this lsi differ from those of the conventional sh-2. for details, see section 5.8.4, notes on slot illegal instruction exception handling. operating modes ? operating modes ? single chip mode ? extended rom enabled mode ? extended rom disabled mode ? operating states ? program execution state ? exception handling state ? bus release state ? power-down modes ? sleep mode ? software standby mode ? deep software standby mode ? hardware standby mode ? module standby mode user break controller (ubc) ? addresses, data values, type of access, and data size can all be set as break conditions ? supports a sequential break function ? two break channels
section 1 overview rev. 3.00 oct. 06, 2008 page 4 of 1080 rej09b0230-0300 items specification on-chip rom ? 256 kbytes/384 kbytes/512 kbytes (see the list in product lineup) on-chip ram ? 12 kbytes/16 kbytes (see the list in product lineup) bus state controller (bsc) ? address space: a maximum 64 mbytes for each of two areas (cs0 and cs1) ? 8-bit external bus ? the following features settable for each area independently ? number of access wait cycles ? idle wait cycle insertion ? supports sram ? outputs a chip select signal according to the target area data transfer controller (dtc) ? data transfer activated by an on-chip peripheral module interrupt can be done independently of the cpu transfer. ? transfer mode selectable for each interrupt source (transfer mode is specified in memory) ? multiple data transfer enabled for one activation source ? various transfer modes normal mode, repeat mode, or block transfer mode can be selected. ? data transfer size can be specified as byte, word, or longword ? the interrupt that activated the dtc can be issued to the cpu. a cpu interrupt can be requested after one data transfer completion. ? a cpu interrupt can be requested after all specified data transfer completion. interrupt controller (intc) ? five external interrupt pins (nmi and irq3 to irq0) ? on-chip peripheral interrupts: priority level set for each module ? vector addresses: a vector address for each interrupt source
section 1 overview rev. 3.00 oct. 06, 2008 page 5 of 1080 rej09b0230-0300 items specification advanced user debugger (aud) ? ram monitor mode audck clock: lower than or equal to both 10 mhz and 1/4 of b modules connected to the internal or external bus can be read and written to. ? branch trace mode aud operation frequency: supports cpu core clock ratios of 1, 1/2, 1/4, and 1/8 with a maximum operating frequency of 20 mhz ? branch address output clock pulse generator (cpg) ? clock mode: input clock can be selected from external input or crystal resonator ? five types of clocks generated: ? cpu clock: maximum 80 mhz (t opr = ? 40 to + 85 c) ? cpu clock: maximum 64 mhz (t opr = ? 40 to + 125 c) ? bus clock: maximum 40 mhz (t opr = ? 40 to + 85 c) ? bus clock: maximum 32 mhz (t opr = ? 40 to + 125 c) ? peripheral clock: maximum 40 mhz (t opr = ? 40 to + 85 c) ? peripheral clock: maximum 32 mhz (t opr = ? 40 to + 125 c) ? mtu2 clock: maximum 40 mhz (t opr = ? 40 to + 85 c) ? mtu2 clock: maximum 32 mhz (t opr = ? 40 to + 125 c) ? mtu2s clock: maximum 80 mhz (t opr = ? 40 to + 85 c) ? mtu2s clock: maximum 64 mhz (t opr = ? 40 to + 125 c) watchdog timer (wdt) ? on-chip one-channel watchdog timer ? interrupt generation is supported.
section 1 overview rev. 3.00 oct. 06, 2008 page 6 of 1080 rej09b0230-0300 items specification multi-function timer pulse unit 2 (mtu2) ? maximum 16 lines of pulse input/output based on five channels of 16- bit timers ? 18 output compare and input capture registers ? a total of 18 independent comparators ? selection of eight counter input clocks ? input capture function ? pulse output modes one-shot, toggle, pwm, complementary pwm, and reset-synchronized pwm modes ? synchronization of multiple counters ? complementary pwm output mode ? non-overlapping waveforms output for 6-phase inverter control ? automatic dead time setting ? 0% to 100% pwm duty cycle specifiable ? output suppression ? a/d conversion delaying function ? interrupt skipping at crest or trough ? reset-synchronized pwm mode three-phase pwm waveforms in positive and negative phases can be output with a required duty cycle ? phase counting mode two-phase encoder pulse counting available multi-function timer pulse unit 2s (mtu2s) ? subset of mtu2, including channels 3 and 4 ? dead time compensation counter available in channel 5 ? operating at 80 mhz max. (t opr = ? 40 to + 85 c) ? operating at 64 mhz max. (t opr = ? 40 to + 125 c) port output enable (poe) ? high-impedance control of waveform output pins in mtu2 and mtu2s compare match timer (cmt) ? 16-bit counters ? compare match interrupts can be generated ? two channels serial communication interface (sci) ? clock synchronous or asynchronous mode ? three channels
section 1 overview rev. 3.00 oct. 06, 2008 page 7 of 1080 rej09b0230-0300 items specification synchronous serial communication unit ? master mode or slave mode selectable ? standard mode or bidirectional mode selectable ? transmit/receive data length can be selected from 8, 16, and 32 bits. ? full-duplex communication (transmission and reception executed simultaneously) ? consecutive serial communication ? one channel controller area network (rcan-et) ? can version: bosch 2.0b active is supported ? buffer size: 15 buffers for transmission/reception and one buffer for reception only ? one channel/two channels (see the list in product lineup) a/d converter (adc) ? 12 bits 16 channels ? conversion request by external triggers, mtu2, or mtu2s ? two sample-and-hold function units (one unit consists of three sample- and-hold circuits) (three channels can be sampled simultaneously by an unit) i/o ports ? 57 general input/output pins ? input or output can be selected for each bit package ? lqfp1414-100 (0.5 pitch) power supply voltage ? vcc: 3.0 to 3.6 v or 4.5 to 5.5 v ? pvcc: 4.5 to 5.5 v ? avcc: 4.5 to 5.5 v
section 1 overview rev. 3.00 oct. 06, 2008 page 8 of 1080 rej09b0230-0300 1.2 block diagram sh2 cpu ubc aud i/o port (pfc) [le g end] rom: ram: ubc: aud: intc: cpg: wdt: cpu: bsc: dtc: pfc: mtu2: mtu2s: poe: sci: cmt: adc: rcan-et: intc wdt cpg peripheral bus (p ) i bus (b ) l bus (i ) mtu2 mtu2s poe synchro- nous serial communi- cation unit cmt power- down mode control external bus peripheral bus controller on-chip rom on-chip ram user break controller advanced user debu gg er interrupt controller clock pulse g enerator watchdo g timer central processin g unit bus state controller data transfer controller pin function controller multi-function timer pulse unit 2 multi-function timer pulse unit 2 (subset) port output enable serial communication interface compare match timer a/d converter controller area network internal bus controller ram rom sci adc rcan-et bsc dtc figure 1.1 block diagram
section 1 overview rev. 3.00 oct. 06, 2008 page 9 of 1080 rej09b0230-0300 1.3 pin assignments lqfp-100 (top view) pv cc md1 md0 av ss an15 an14 an13 an12 an11 an10 an9 an8 av refh an7 an6 an5 an4 av refl an3 an2 an1 an0 av cc hstby wdtovf 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 pllv ss fwe nmi extal xtal res pa0/a0/ poe0 /rxd0 pa1/a1/ poe1 /txd0 pa2/a2/irq0/ poe2 /sck0 pa3/a3/irq1/rxd1 pa4/a4/irq2/txd1 pv ss pa5/a5/irq3/sck1 pa6/ rd / ubctrg /tclka/ poe 4 pa7/tclkb/ poe5 /sck2 pa8/ wrl /tclkc/ poe6 /rxd2 v cl pa9/ wait /tclkd/ poe8 /txd2 pv cc pa10/a6/rxd0 pa11/a7/txd0/ adtrg pa12/a8/sck0/ scs pa13/a9/sck1/ssck pa14/a10/rxd1/ssi pa15/ck/txd1/sso 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 v ss pb0/ back /tic5ws/ctx1 * v cc pb1/ breq /crx1 * pb2/a16/irq0/ poe0 /tic5vs pb3/a17/irq1/ poe1 pb4/a18/irq2/ poe4 /tic5us pb5/a19/irq3/ poe5 pb6/ wait /ctx0 pb7/ cs1 /crx0 pd0/d0/audata0/rxd0 pv ss pd1/d1/audata1/txd0 pd2/d2/audata2/sck0 pv cc pd3/d3/audata3/rxd1 pd4/d4/ audrst /txd1 pd5/d5/audmd/sck1 pd6/d6/audck/rxd2 pd7/d7/ audsync /txd2/ sc s pd8/sck2/ssck pd9/ssi pd10/sso pe0/tioc0a pe1/tioc0b/rxd0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 v ss pe21/ wrl /tioc4ds v cc pe20/tioc4cs pe19/ rd /tioc4bs pe18/ cs1 /tioc4as pe17/ cs0 /tioc3ds pe16/ wait /tioc3bs pe15/tioc4d/ irqout pe14/tioc4c pv cc pe13/tioc4b/ mres pe12/tioc4a pv ss pe11/tioc3d v cl pe9/tioc3b pe10/ cs0 /tioc3c pe8/a15/tioc3a pe7/a14/tioc2b pe6/a13/tioc2a/sck1 pe5/a12/tioc1b/txd1 pe4/a11/tioc1a/rxd1 pe3/tioc0d/sck0 pe2/tioc0c/txd0 note: * available only in the sh7142. figure 1.2 pin assignments
section 1 overview rev. 3.00 oct. 06, 2008 page 10 of 1080 rej09b0230-0300 1.4 pin functions table 1.2 summarizes the pin functions. table 1.2 pin functions classification symbol i/o name function vcc i power supply power supply pins connect all vcc pins to the system power supply. the lsi does not operate if any vcc pins are open. supply current increases while the chip is being powered up. vss i ground ground pins connect all vss pins to the system power supply (0v). the lsi does not operate if any pins are open. pvcc i power supply power supply for i/o pins connect all pvcc pins to the system power supply. the lsi does not operate if any pins are open. supply current increases while the chip is being powered up. pvss i ground ground for i/o pins connect all pvss pins to the system power supply (0v). the lsi does not operate if any pins are open. power supply v cl o internal step- down power supply external capacitance pins for internal step-down power supply connect these pins to vss via a 0.47 f capacitor (should be placed close to the pins). pllvss i pll ground ground pin for the on-chip pll oscillator extal i external clock connected to a crystal resonator. an external clock signal may also be input to the extal pin. clock xtal o crystal connected to a crystal resonator. ck o system clock supplies the system clock to external devices.
section 1 overview rev. 3.00 oct. 06, 2008 page 11 of 1080 rej09b0230-0300 classification symbol i/o name function md1, md0 i mode set sets the operating mode. do not change values on these pins during operation. operating mode control fwe i flash memory write enable pin for flash memory flash memory can be protected against programming or erasure through this pin. res i power-on reset when low, this lsi enters the power- on reset state. mres i manual reset when low, this lsi enters the manual reset state. hstby i hardware standby when low, this lsi enters hardware standby mode. when no signal is input through this pin, it is pulled up inside this lsi. high level must be input to this pin while the chip is being powered up. wdtovf o watchdog timer overflow output signal for the watchdog timer overflow since this pin stays in a hi-z state for a while after deep standby mode is exited, this pin must be pulled up. system control breq i bus-mastership request low when an external device requests the release of the bus mastership. back o bus-mastership request acknowledge indicates that the bus mastership has been released to an external device. reception of the back signal informs the device which has output the breq signal that it has acquired the bus.
section 1 overview rev. 3.00 oct. 06, 2008 page 12 of 1080 rej09b0230-0300 classification symbol i/o name function nmi i non-maskable interrupt non-maskable interrupt request pin fix to high or low level when not in use. interrupts irq3 to irq0 i interrupt requests 3 to 0 maskable interrupt request pin selectable as level input or edge input. the rising edge, falling edge, and both edges are selectable as edges. irqout o interrupt request output shows that an interrupt cause has occurred. the interrupt cause can be recognized even in the bus release state. address bus a19 to a0 o a ddress bus outputs addresses data bus d7 to d0 i/o data bus bidirectional bus cs1 , cs0 o chip select 1 and 0 chip-select signal for external memory or devices bus control rd o read indicates reading of data from external devices. wrl o write to lower byte indicates a write access to bits 7 to 0 of the external data. wait i wait input signal for inserting a wait cycle into the bus cycles during access to the external space tclka, tclkb, tclkc, tclkd i mtu2 timer clock input external clock input pins for the timer multi function timer- pulse unit 2 (mtu2) tioc0a, tioc0b, tioc0c, tioc0d i/o mtu2 input capture/output compare (channel 0) the tgra_0 to tgrd_0 input capture input/output compare output/pwm output pins tioc1a, tioc1b i/o mtu2 input capture/output compare (channel 1) the tgra_1 to tgrb_1 input capture input/output compare output/pwm output pins
section 1 overview rev. 3.00 oct. 06, 2008 page 13 of 1080 rej09b0230-0300 classification symbol i/o name function tioc2a, tioc2b i/o mtu2 input capture/output compare (channel 2) the tgra_2 to tgrb_2 input capture input/output compare output/pwm output pins tioc3a, tioc3b, tioc3c, tioc3d i/o mtu2 input capture/output compare (channel 3) the tgra_3 to tgrd_3 input capture input/output compare output/pwm output pins multi function timer- pulse unit 2 (mtu2) tioc4a, tioc4b, tioc4c, tioc4d i/o mtu2 input capture/output compare (channel 4) the tgra_4 to tgrd_4 input capture input/output compare output/pwm output pins tioc3bs, tioc3ds i/o mtu2s input capture/output compare (channel 3) the tgrb_3s and tgrd_3s input capture input/output compare output/pwm output pins tioc4as, tioc4bs, tioc4cs, tioc4ds i/o mtu2s input capture/output compare (channel 4) the tgra_4s to tgrd_4s input capture input/output compare output/pwm output pins multi function timer- pulse unit 2s (mtu2s) tic5us, tic5vs, tic5ws i mtu2s input capture (channel 5) the tgru_5s, tgrv_5s, and tgrw_5s input capture input pins port output enable (poe) poe8 , poe6 to poe4 , poe2 to poe0 i port output enable request signal input to place the mtu2 and mtu2s waveform output pins in high impedance state. txd2 to txd0 o transmit data transmit data output pins rxd2 to rxd0 i receive data receive data input pins serial communication interface (sci) sck2 to sck0 i/o serial clock clock input/output pins sso i/o data data input/output pin ssi i/o data data input/output pin synchronous serial communication unit ssck i/o clock clock input/output pin scs i/o chip select chip select input/output pin
section 1 overview rev. 3.00 oct. 06, 2008 page 14 of 1080 rej09b0230-0300 classification symbol i/o name function ctx1 * , ctx0 o transmit data transmit data pin for can bus controller area network (rcan-et) crx1 *, crx0 i receive data receive data pin for can bus an15 to an0 i analog input pins analog input pins adtrg i a/d conversion trigger input external trigger input pin for starting a/d conversion avcc i analog power supply power supply pin for the a/d converter connect it to the system power supply (pvcc) when the a/d converter is not used. connect all avcc pins to the system power supply (pvcc) the a/d converter does not work if any pin is open. avss i analog ground ground pin for the a/d converter connect it to the system ground (0 v). connect all avss pins to the system ground (0 v) correctly. the a/d converter does not work if any pin is open. avrefh i analog reference power supply (high) analog reference power supply (high) a/d converter (adc) avrefl i analog reference power supply (low) analog reference power supply (low) pa15 to pa0 i/o general port general input/output port pins pb7 to pb0 i/o general port general input/output port pins pd10 to pd0 i/o general port general input/output port pins i/o ports pe21 to pe0 i/o general port general input/output port pins user break controller (ubc) ubctrg o user break trigger output trigger output pin for ubc condition match
section 1 overview rev. 3.00 oct. 06, 2008 page 15 of 1080 rej09b0230-0300 classification symbol i/o name function audata3 to audata0 i/o aud data branch trace mode: branch source/destination address output pins ram monitor mode: monitor address input, or data i/o pins audrst i aud reset reset signal input pin audmd i aud mode mode select signal input pin branch trace mode (l) ram monitor mode (h) advanced user debugger (aud) audck i/o aud clock branch trace mode: sync-clock output pin ram monitor mode: sync-clock input pin audsync i/o aud sync signal branch trace mode: data start-position acknowledge- signal output pin ram monitor mode: data start-position acknowledge- signal input pin note: * available only in the sh7142.
section 1 overview rev. 3.00 oct. 06, 2008 page 16 of 1080 rej09b0230-0300
section 2 cpu rev. 3.00 oct. 06, 2008 page 17 of 1080 rej09b0230-0300 section 2 cpu 2.1 features ? general registers: 32-bit register 16 ? basic instructions: 62 ? addressing modes: 11 register direct (rn) register indirect (@rn) post-increment register indirect (@rn + ) pre-decrement register indirect (@-rn) register indirect with displacement (@disp:4, rn) index register indirect (@r0, rn) gbr indirect with displacement (@disp:8, gbr) index gbr indirect (@r0, gbr) pc relative with disp lacement (@disp:8, pc) pc relative (disp:8/disp:12/rn) immediate (#imm:8)
section 2 cpu rev. 3.00 oct. 06, 2008 page 18 of 1080 rej09b0230-0300 2.2 register configuration there are three types of registers: general registers (32-bit 16), control registers (32-bit 3), and system registers (32-bit 4). 31 0 r0 * 1 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15, sp (hardware stack pointer)0 * 2 31 9 8 7 6 5 4 3 2 1 0 0 0 31 m gbr 31 vbr qi3i2i1i0 s t 31 0 mach 31 0 pr 31 0 pc macl notes: 1. r0 can be used as an index re g ister in index re g ister indirect or index gbr indirect addressin g mode. for some instructions, only r0 is used as the source or destination re g ister. 2. r15 is used as a hardware stack pointer durin g exception handlin g . general re g ister (rn) status re g ister (sr) global base re g ister (gbr) vector base re g ister (vbr) multiply and accumulate re g ister (mac) procedure re g ister (pr) pro g ram counter (pc) figure 2.1 cpu internal register configuration
section 2 cpu rev. 3.00 oct. 06, 2008 page 19 of 1080 rej09b0230-0300 2.2.1 general registers (rn) there are sixteen 32-bit general registers (rn), designated r0 to r15. the general registers are used for data processing and address calculation. r0 is also used as an index register. with a number of instructions, r0 is the only register that can be used. r15 is used as a hardware stack pointer (sp). in exception handling, r15 is used for accessing the stack to save or restore the status register (sr) and program counter (pc) values. 2.2.2 control registers there are three 32-bit control registers, designated status register (sr), global base register (gbr), and vector base register (vbr). sr indi cates a processing state. gbr is used as a base address in gbr indirect addressing mode for data transfer of on-chip peripheral module registers. vbr is used as a base address of the exception handling (including interrupts) vector table. ? status register (sr) bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 rrrrrrrrrrrrrrrr 000000 - - 111100 - - rrrrrrr/wr/wr/wr/wr/wr/wrrr/wr/w ---------------- - - - - - - m q i[3:0] - - s t bit bit name default read/ write description 31 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 m undefined r/w used by the div0u, div0s, and div1 instructions. 8 q undefined r/w used by the div0u, div0s, and div1 instructions. 7 to 4 i[3:0] 1111 r/w interrupt mask 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 2 cpu rev. 3.00 oct. 06, 2008 page 20 of 1080 rej09b0230-0300 bit bit name default read/ write description 1 s undefined r/w s bit used by the multiply and accumulate instruction. 0 t undefined r/w t bit indicates true (1) or false (0) in the following instructions: movt, cmp/cond, tas, tst, bt (bt/s), bf (bf/s), sett, clrt indicates carry, borrow, overflow, or underflow in the following instructions: addv, addc, subv, subc, negc, div0u, div0s, di v1, shar, shal, shlr, shll, rotr, rotl , rotcr, rotcl ? global-base register (gbr) this register indicates a base address in gbr indirect addressing mode. the gbr indirect addressing mode is used for data transfer of the on-chip peripheral module registers and logic operations. ? vector-base register (vbr) this register indicates the base addre ss of the exception handling vector table.
section 2 cpu rev. 3.00 oct. 06, 2008 page 21 of 1080 rej09b0230-0300 2.2.3 system registers there are four 32-bit system registers, designated two multiply and accumulate registers (mach and macl), a procedure register (pr), and program counter (pc). ? multiply and accumulate registers (mach and macl) this register stores the results of multip lication and multiply-and-accumulate operation. ? procedure register (pr) this register stores the return-destination address from subroutine procedures. ? program counter (pc) the pc indicates the point which is four bytes (two instructions) af ter the current execution instruction. 2.2.4 initial values of registers table 2.1 lists the initial values of registers after a reset. table 2.1 initial values of registers type of register register default general register r0 to r14 undefined r15 (sp) sp value set in the exception handling vector table control register sr i3 to i0: 1111 (h'f) reserved bits: 0 other bits: undefined gbr undefined vbr h'00000000 system register mach, macl, pr undefined pc pc value set in the exception handling vector table
section 2 cpu rev. 3.00 oct. 06, 2008 page 22 of 1080 rej09b0230-0300 2.3 data formats 2.3.1 register data format the size of register operands is always longwords (32 bits). when loading byte (8 bits) or word (16 bits) data in memory into a register, the data is sign-extended to longword and stored in the register. lon g word 31 0 figure 2.2 register data format 2.3.2 memory data formats memory data formats are classified into bytes, words, and longwords. byte data can be accessed from any address. locate, however, word data at an address 2n, longword data at 4n. otherwise, an address error will occur if an attempt is made to access word data starting from an address other than 2n or longword data starting from an address other than 4n. in such cases, the data accessed cannot be guaranteed. the hardware stack area, pointed by the hardware stack pointer (sp, r15), uses only longword data starting from address 4n because this area holds the program counter and status register. byte byte byte byte word word lon g word 31 23 15 7 address m + 1 address 2n address 4n address m address m + 3 address m + 2 0 figure 2.3 memory data format
section 2 cpu rev. 3.00 oct. 06, 2008 page 23 of 1080 rej09b0230-0300 2.3.3 immediate data formats immediate data of eight bits is placed in the instruction code. for the mov, add, and cmp/eq instructions, the immediate data is sign-extended to longword and then calculated. for the tst, and, or, and xor instructions, the immediate data is zero- extended to longword and then calculated. thus , if the immediate data is used for the and instruction, the upper 24 bits in the destination register are always cleared. the immediate data of word or longword is not placed in the inst ruction code. it is placed in a table in memory. the table in memory is accesse d by the mov immediate data instruction in pc relative addressing mode with displacement. 2.4 features of instructions 2.4.1 risc type the instructions are risc-type instructions with the following features: fixed 16-bit length: all instructions have a fixed length of 16 bits. this improves program code efficiency. one instruction per cycle: since pipelining is used, basic instructions can be executed in one cycle. data size: the basic data size for operations is longword. byte, word, or longword can be selected as the memory access size. byte or word data in memory is sign-extended to longword and then calculated. immediate data is sign-extended to longword for arithmetic operations or zero-extended to longword size for logical operations. table 2.2 word data sign extension cpu in this lsi description example of other cpus mov.w @(disp,pc),r1 add r1,r0 ........ .data.w h'1234 sign-extended to 32 bits, r1 becomes h'00001234, and is then operated on by the add instruction. add.w #h'1234,r0 note: immediate data is accessed by @(disp,pc).
section 2 cpu rev. 3.00 oct. 06, 2008 page 24 of 1080 rej09b0230-0300 load/store architecture: basic operations are executed betw een registers. in operations involving memory, data is first loaded into a register (load/store architecture). however, bit manipulation instructions such as and are executed directly in memory. delayed branching: unconditional branch instructions means the delayed branch instructions. with a delayed branch instruction, the branch is made after execution of the instruction immediately following the delayed branch instruction. this minimizes disruption of the pipeline when a branch is made. the conditional branch instructions have two types of instructions: conditional branch instructions and delayed branch instructions. table 2.3 delayed branch instructions cpu in this lsi description example of other cpus bra trget add r1,r0 add is executed before branch to trget. add.w r1,r0 bra trget multiply/multiply-and-accumulate operations: a 16 16 32 multiply operation is executed in one to two cycles, and a 16 16 + 64 64 multiply-and-accumulate operation in two to three cycles. a 32 32 64 multiply operation and a 32 32 + 64 64 multiply-and- accumulate operation are each execu ted in two to four cycles. t bit: the result of a comparison is indicated by th e t bit in sr, and a conditional branch is performed according to whether th e result is true or false. processing speed has been improved by keeping the number of instructions that modify the t bit to a minimum. table 2.4 t bit cpu in this lsi description example of other cpus cmp/ge r1,r0 when r0 r1, the t bit is set. cmp.w r1,r0 bt trget0 when r0 r1, a branch is made to trget0. bge trget0 bf trget1 when r0 < r1, a branch is made to trget1. blt trget1 add # ? 1,r0 the t bit is not changed by add. sub.w #1,r0 cmp/eq #0,r0 when r0 = 0, the t bit is set. beq trget bt trget a branch is made when r0 = 0. immediate data: 8-bit immediate data is placed in th e instruction code. word and longword immediate data is not placed in th e instruction code. it is placed in a table in memory. the table in memory is accessed with the mov immediate data instruction using pc relative addressing mode with displacement.
section 2 cpu rev. 3.00 oct. 06, 2008 page 25 of 1080 rej09b0230-0300 table 2.5 access to immediate data type this lsi's cpu example of other cpu 8-bit immediate mov #h'12,r0 mov.b #h'12,r0 16-bit immediate mov.w @(disp,pc),r0 ........ .data.w h'1234 mov.w #h'1234,r0 32-bit immediate mov.l @(disp,pc),r0 ........ .data.l h'12345678 mov.l #h'12345678,r0 note: * immediate data is accessed by @(disp,pc). absolute addresses: when data is accessed by absolute addr ess, place the absolute address value in a table in memory beforehand. the absolute address value is transferred to a register using the method whereby immediate data is loaded when an instruction is executed, and the data is accessed using the register indirect addressing mode. table 2.6 access to absolute address type cpu in this lsi example of other cpus absolute address mov.l @(disp,pc),r1 mov.b @r1,r0 ........ .data.l h'12345678 mov.b @h'12345678,r0 note: * immediate data is referenced by @(disp,pc). 16-bit/32-bit displacement: when data is accessed using the 16- or 32-bit displacement addressing mode, the displacement value is placed in a table in memory beforehand. using the method whereby immediate data is loaded when an instruction is executed, this value is transferred to a register and the data is accesse d using index register i ndirect addressing mode.
section 2 cpu rev. 3.00 oct. 06, 2008 page 26 of 1080 rej09b0230-0300 table 2.7 access with displacement type cpu in this lsi example of other cpus 16-bit displacement mov.w @(disp,pc),r0 mov.w @(r0,r1),r2 ........ .data.w h'1234 mov.w @(h'1234,r1),r2 note: * immediate data is referenced by @(disp,pc). 2.4.2 addressing modes table 2.8 lists addressing modes and effective address calculation methods. table 2.8 addressing modes and effective addresses addressing mode instruction format effective address calculation method calculation formula register direct rn effective address is register rn. (operand is register rn contents.) ? register indirect @rn effective address is register rn contents. rn rn rn register indirect with post-increment @rn+ effective address is register rn contents. a constant is added to rn after instruction execution: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn rn 1/2/4 + rn + 1/2/4 rn after instruction execution byte: rn + 1 rn word: rn + 2 rn longword: rn + 4 rn register indirect with pre-decrement @?rn effective address is register rn contents, decremented by a constant beforehand: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn rn - 1/2/4 1/2/4 - rn - 1/2/4 byte: rn ? 1 rn word: rn ? 2 rn longword: rn ? 4 rn (instruction executed with rn after calculation)
section 2 cpu rev. 3.00 oct. 06, 2008 page 27 of 1080 rej09b0230-0300 addressing mode instruction format effective address calculation method calculation formula register indirect with displacement @(disp:4, rn) effective address is register rn contents with 4-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. 1/2/4 disp (zero-extended) rn + disp 1/2/4 + rn byte: rn + disp word: rn + disp 2 longword: rn + disp 4 index register indirect @(r0, rn) effective address is sum of register rn and r0 contents. + rn r0 rn + r0 rn + r0 gbr indirect with displacement @(disp:8, gbr) effective address is register gbr contents with 8-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. gbr 1/2/4 disp (zero-extended) gbr + disp 1/2/4 + byte: gbr + disp word: gbr + disp 2 longword: gbr + disp 4 index gbr indirect @(r0, gbr) effective address is sum of register gbr and r0 contents. gbr gbr + r0 r0 + gbr + r0
section 2 cpu rev. 3.00 oct. 06, 2008 page 28 of 1080 rej09b0230-0300 addressing mode instruction format effective address calculation method calculation formula pc relative with displacement @(disp:8, pc) effective address is pc with 8-bit displacement disp added. after disp is zero-extended, it is multiplied by 2 (word) or 4 (longword), according to the operand size. with a longword operand, the lower 2 bits of pc are masked. pc pc + disp 2 or pc& h'fffffffc + disp 4 h'fffffffc + & 2/4 disp (zero-extended) * * with lon g word operand word: pc + disp 2 longword: pc&h'fffffffc + disp 4 pc relative disp:8 effective address is pc with 8-bit displacement disp added after being sign-extended and multiplied by 2. pc 2 disp (si g n-extended) pc + disp 2 + pc + disp 2 disp:12 effective address is pc with 12-bit displacement disp added after being sign-extended and multiplied by 2. pc 2 disp (si g n-extended) pc + disp 2 + pc + disp 2
section 2 cpu rev. 3.00 oct. 06, 2008 page 29 of 1080 rej09b0230-0300 addressing mode instruction format effective address calculation method calculation formula pc relative rn effective address is sum of pc and rn. pc pc + rn rn + pc + rn immediate #imm:8 8-bit immediate data imm of tst, and, or, or xor instruction is zero-extended. ? #imm:8 8-bit immediate data imm of mov, add, or cmp/eq instruction is sign-extended. ? #imm:8 8-bit immediate data imm of trapa instruction is zero-extended and multiplied by 4. ? 2.4.3 instruction formats this section describes the instruction formats, and the meaning of the source and destination operands. the meaning of the operands depends on the instruction code. the following symbols are used in the table. xxxx: instruction code mmmm: source register nnnn: destination register iiii: immediate data dddd: displacement
section 2 cpu rev. 3.00 oct. 06, 2008 page 30 of 1080 rej09b0230-0300 table 2.9 instruction formats instruction format source operand destination operand sample instruction 0 type xxxx xxxx xxxx xxxx 15 0 ? ? nop ? nnnn : register direct movt rn control register or system register nnnn : register direct sts mach,rn n type xxxx nnnn xxxx xxxx 15 0 control register or system register nnnn : pre- decrement register indirect stc.l sr,@-rn mmmm : register direct control register or system register ldc rm,sr mmmm : post- increment register indirect control register or system register ldc.l @rm+,sr m type xxxx mmmm xxxx xxxx 15 0 mmmm : register indirect ? jmp @rm pc relative using rm ? braf rm
section 2 cpu rev. 3.00 oct. 06, 2008 page 31 of 1080 rej09b0230-0300 instruction format source operand destination operand sample instruction mmmm : register direct nnnn : register direct add rm,rn mmmm : register direct nnnn : register indirect mov.l rm,@rn mmmm : post- increment register indirect (multiply- and-accumulate operation) nnnn : * post- increment register indirect (multiply- and-accumulate operation) mach, macl mac.w @rm+,@rn+ mmmm : post- increment register indirect nnnn : register direct mov.l @rm+,rn mmmm : register direct nnnn : pre- decrement register indirect mov.l rm,@-rn nm type xxxx nnnn mmmm xxxx 15 0 mmmm : register direct nnnn : index register indirect mov.l rm,@(r0,rn) md type xxxx xxxx mmmm dddd 15 0 mmmmdddd : register indirect with displacement r0 (register direct) mov.b @(disp,rm),r0 nd4 type xxxx xxxx nnnn dddd 15 0 r0 (register direct) nnnndddd : register indirect with displacement mov.b r0,@(disp,rn) nmd type xxxx nnnn mmmm dddd 15 0 mmmm : register direct nnnndddd : register indirect with displacement mov.l rm,@(disp,rn) mmmmdddd : register indirect with displacement nnnn : register direct mov.l @(disp,rm),rn
section 2 cpu rev. 3.00 oct. 06, 2008 page 32 of 1080 rej09b0230-0300 instruction format source operand destination operand sample instruction dddddddd : gbr indirect with displacement r0 (register direct) mov.l @(disp,gbr),r0 r0 (register direct) dddddddd : gbr indirect with displacement mov.l r0,@(disp,gbr) dddddddd : pc relative with displacement r0 (register direct) mova @(disp,pc),r0 d type xxxx xxxx dddd dddd 15 0 ? dddddddd : pc relative bf label d12 type xxxx dddd dddd dddd 15 0 ? dddddddddddd : pc relative bra label (label=disp+pc) nd8 type xxxx nnnn dddd dddd 15 0 dddddddd : pc relative with displacement nnnn : register direct mov.l @(disp,pc),rn iiiiiiii : immediate index gbr indirect and.b #imm,@(r0,gbr) iiiiiiii : immediate r0 (register direct) and #imm,r0 i type xxxx xxxx iiii iiii 15 0 iiiiiiii : immediate ? trapa #imm ni type xxxx nnnn iiii iiii 15 0 iiiiiiii : immediate nnnn : register direct add #imm,rn note: * in multiply and accumulate instructions, nnnn is the source register.
section 2 cpu rev. 3.00 oct. 06, 2008 page 33 of 1080 rej09b0230-0300 2.5 instruction set 2.5.1 instruction set by type table 2.10 lists the instructions classified by type. table 2.10 instruction types type kinds of instruction op code function number of instructions mov data transfer immediate data transfer peripheral module data transfer structure data transfer mova effective address transfer movt t bit transfer swap upper/lower swap data transfer instructions 5 xtrct extraction of middle of linked registers 39 add binary addition addc binary addition with carry addv binary addition with overflow cmp/cond comparison div1 division div0s signed division initialization div0u unsigned division initialization dmuls signed double-precision multiplication dmulu unsigned double-precision multiplication dt decrement and test exts sign extension extu zero extension arithmetic operation instructions 21 mac multiply-and-accumulate, double- precision multiply-and-accumulate 33 mul double-precision multiplication
section 2 cpu rev. 3.00 oct. 06, 2008 page 34 of 1080 rej09b0230-0300 type kinds of instruction op code function number of instructions muls signed multiplication mulu unsigned multiplication neg sign inversion negc sign inversion with borrow sub binary subtraction subc binary subtraction with carry arithmetic operation instructions 21 subv binary subtraction with underflow 33 and logical and not bit inversion or logical or tas memory test and bit setting tst t bit setting for logical and logic operation instructions 6 xor exclusive logical or 14 rotl 1-bit left shift rotr 1-bit right shift rotcl 1-bit left shift with t bit rotcr 1-bit right shift with t bit shal arithmetic 1-bit left shift shar arithmetic 1-bit right shift shll logical 1-bit left shift shlln logical n-bit left shift shift instructions 10 shlr logical 1-bit right shift 14 shlrn logical n-bit right shift
section 2 cpu rev. 3.00 oct. 06, 2008 page 35 of 1080 rej09b0230-0300 type kinds of instruction op code function number of instructions bf conditional branch, delayed conditional branch (t = 0) bt conditional branch, delayed conditional branch (t = 1) bra unconditional branch braf unconditional branch bsr branch to subroutine procedure bsrf branch to subroutine procedure jmp unconditional branch jsr branch to subroutine procedure branch instructions 9 rts return from subroutine procedure 11 clrt t bit clear clrmac mac register clear ldc load into control register lds load into system register nop no operation rte return from exception handling sett t bit setting sleep transition to power-down mode stc store from control register sts store from system register system control instructions 11 trapa trap exception handling 31 total: 62 142
section 2 cpu rev. 3.00 oct. 06, 2008 page 36 of 1080 rej09b0230-0300 the instruction code, operation, and execution cycles of the instructions are listed in the following tables, classified by type. instruction instruction code summary of operation execution cycles t bit indicated by mnemonic. explanation of symbols op.sz src, dest op: operation code sz: size src: source dest: destination rm: source register rn: destination register imm: immediate data disp: displacement * 2 indicated in msb ? lsb order. explanation of symbols mmmm: source register nnnn: destination register 0000: r0 0001: r1 ......... 1111: r15 iiii: immediate data dddd: displacement indicates summary of operation. explanation of symbols , : transfer direction (xx): memory operand m/q/t: flag bits in sr &: logical and of each bit |: logical or of each bit ^: exclusive logical or of each bit ?: logical not of each bit <>n: n-bit right shift value when no wait cycles are inserted * 1 value of t bit after instruction is executed explanation of symbols ? : no change notes: 1. the table shows the minimum number of execution states. in practice, the number of instruction execution states will be increased in cases such as the following: ? when there is contention between an instruction fetch and a data access ? when the destination register of a load instruction (memory register) is also used by the following instruction 2. scaled ( 1, 2, or 4) according to the instruction operand size, etc. for details, see sh-1/sh-2/sh-dsp software manual.
section 2 cpu rev. 3.00 oct. 06, 2008 page 37 of 1080 rej09b0230-0300 2.5.2 data transfer instructions table 2.11 data transfer instructions instruction operation code execution cycles t bit mov #imm,rn imm sign extension rn 1110nnnniiiiiiii 1 ? mov.w @(disp,pc),rn (disp 2 + pc) sign extension rn 1001nnnndddddddd 1 ? mov.l @(disp,pc),rn (disp 4 + pc) rn 1101nnnndddddddd 1 ? mov rm,rn rm rn 0110nnnnmmmm0011 1 ? mov.b rm,@rn rm (rn) 0010nnnnmmmm0000 1 ? mov.w rm,@rn rm (rn) 0010nnnnmmmm0001 1 ? mov.l rm,@rn rm (rn) 0010nnnnmmmm0010 1 ? mov.b @rm,rn (rm) sign extension rn 0110nnnnmmmm0000 1 ? mov.w @rm,rn (rm) sign extension rn 0110nnnnmmmm0001 1 ? mov.l @rm,rn (rm) rn 0110nnnnmmmm0010 1 ? mov.b rm,@ ? rn rn?1 rn, rm (rn) 0010nnnnmmmm0100 1 ? mov.w rm,@ ? rn rn?2 rn, rm (rn) 0010nnnnmmmm0101 1 ? mov.l rm,@ ? rn rn?4 rn, rm (rn) 0010nnnnmmmm0110 1 ? mov.b @rm+,rn (rm) sign extension rn, rm + 1 rm 0110nnnnmmmm0100 1 ? mov.w @rm+,rn (rm) sign extension rn, rm + 2 rm 0110nnnnmmmm0101 1 ? mov.l @rm+,rn (rm) rn,rm + 4 rm 0110nnnnmmmm0110 1 ? mov.b r0,@(disp,rn) r0 (disp + rn) 10000000nnnndddd 1 ? mov.w r0,@(disp,rn) r0 (disp 2 + rn) 10000001nnnndddd 1 ? mov.l rm,@(disp,rn) rm (disp 4 + rn) 0001nnnnmmmmdddd 1 ? mov.b @(disp,rm),r0 (disp + rm) sign extension r0 10000100mmmmdddd 1 ? mov.w @(disp,rm),r0 (disp 2 + rm) sign extension r0 10000101mmmmdddd 1 ? mov.l @(disp,rm),rn (disp 4 + rm) rn 0101nnnnmmmmdddd 1 ?
section 2 cpu rev. 3.00 oct. 06, 2008 page 38 of 1080 rej09b0230-0300 instruction operation code execution cycles t bit mov.b rm,@(r0,rn) rm (r0 + rn) 0000nnnnmmmm0100 1 ? mov.w rm,@(r0,rn) rm (r0 + rn) 0000nnnnmmmm0101 1 ? mov.l rm,@(r0,rn) rm (r0 + rn) 0000nnnnmmmm0110 1 ? mov.b @(r0,rm),rn (r0 + rm) sign extension rn 0000nnnnmmmm1100 1 ? mov.w @(r0,rm),rn (r0 + rm) sign extension rn 0000nnnnmmmm1101 1 ? mov.l @(r0,rm),rn (r0 + rm) rn 0000nnnnmmmm1110 1 ? mov.b r0,@(disp,gbr) r0 (disp + gbr) 11000000dddddddd 1 ? mov.w r0,@(disp,gbr) r0 (disp 2 + gbr) 11000001dddddddd 1 ? mov.l r0,@(disp,gbr) r0 (disp 4 + gbr) 11000010dddddddd 1 ? mov.b @(disp,gbr),r0 (disp + gbr) sign extension r0 11000100dddddddd 1 ? mov.w @(disp,gbr),r0 (disp 2 + gbr) sign extension r0 11000101dddddddd 1 ? mov.l @(disp,gbr),r0 (disp 4 + gbr) r0 11000110dddddddd 1 ? mova @(disp,pc),r0 disp 4 + pc r0 11000111dddddddd 1 ? movt rn t rn 0000nnnn00101001 1 ? swap.b rm,rn rm swap lowest two bytes rn 0110nnnnmmmm1000 1 ? swap.w rm,rn rm swap two consecutive words rn 0110nnnnmmmm1001 1 ? xtrct rm,rn rm: middle 32 bits of rn rn 0010nnnnmmmm1101 1 ?
section 2 cpu rev. 3.00 oct. 06, 2008 page 39 of 1080 rej09b0230-0300 2.5.3 arithmetic operation instructions table 2.12 arithmetic operation instructions instruction operation code execution cycles t bit add rm,rn rn + rm rn 0011nnnnmmmm1100 1 ? add #imm,rn rn + imm rn 0111nnnniiiiiiii 1 ? addc rm,rn rn + rm + t rn, carry t 0011nnnnmmmm1110 1 carry addv rm,rn rn + rm rn, overflow t 0011nnnnmmmm1111 1 overflow cmp/eq #imm,r0 if r0 = imm, 1 t 10001000iiiiiiii 1 comparison result cmp/eq rm,rn if rn = rm, 1 t 0011nnnnmmmm0000 1 comparison result cmp/hs rm,rn if rn rm with unsigned data, 1 t 0011nnnnmmmm0010 1 comparison result cmp/ge rm,rn if rn rm with signed data, 1 t 0011nnnnmmmm0011 1 comparison result cmp/hi rm,rn if rn > rm with unsigned data, 1 t 0011nnnnmmmm0110 1 comparison result cmp/gt rm,rn if rn > rm with signed data, 1 t 0011nnnnmmmm0111 1 comparison result cmp/pz rn if rn 0, 1 t 0100nnnn00010001 1 comparison result cmp/pl rn if rn > 0, 1 t 0100nnnn00010101 1 comparison result cmp/str rm,rn if rn and rm have an equivalent byte, 1 t 0010nnnnmmmm1100 1 comparison result div1 rm,rn single-step division (rn/rm) 0011nnnnmmmm0100 1 calculation result div0s rm,rn msb of rn q, msb of rm m, m^ q t 0010nnnnmmmm0111 1 calculation result div0u 0 m/q/t 0000000000011001 1 0 dmuls.l rm,rn signed operation of rn rm mach, macl 32 32 64 bits 0011nnnnmmmm1101 2 to 5 * ?
section 2 cpu rev. 3.00 oct. 06, 2008 page 40 of 1080 rej09b0230-0300 instruction operation code execution cycles t bit dmulu.l rm,rn unsigned operation of rn rm mach, macl 32 32 64 bits 0011nnnnmmmm0101 2 to 5 * ? dt rn rn - 1 rn, if rn = 0, 1 t, else 0 t 0100nnnn00010000 1 comparison result exts.b rm,rn a byte in rm is sign- extended rn 0110nnnnmmmm1110 1 ? exts.w rm,rn a word in rm is sign- extended rn 0110nnnnmmmm1111 1 ? extu.b rm,rn a byte in rm is zero- extended rn 0110nnnnmmmm1100 1 ? extu.w rm,rn a word in rm is zero- extended rn 0110nnnnmmmm1101 1 ? mac.l @rm+,@rn+ signed operation of (rn) (rm) + mac mac, 32 32 + 64 64 bits 0000nnnnmmmm1111 2 to 5 * ? mac.w @rm+,@rn+ signed operation of (rn) (rm) + mac mac, 16 16 + 64 64 bits 0100nnnnmmmm1111 2 to 4 * ? mul.l rm,rn rn rm macl 32 32 32 bits 0000nnnnmmmm0111 2 to 5 * ? muls.w rm,rn signed operation of rn rm mac 16 16 32 bits 0010nnnnmmmm1111 1 to 3 * ? mulu.w rm,rn unsigned operation of rn rm mac 16 16 32 bits 0010nnnnmmmm1110 1 to 3 * ? neg rm,rn 0-rm rn 0110nnnnmmmm1011 1 ? negc rm,rn 0-rm-t rn, borrow t 0110nnnnmmmm1010 1 borrow sub rm,rn rn-rm rn 0011nnnnmmmm1000 1 ? subc rm,rn rn-rm?t rn, borrow t 0011nnnnmmmm1010 1 borrow subv rm,rn rn-rm rn, underflow t 0011nnnnmmmm1011 1 overflow note: * indicates the number of execution cycles for normal operation.
section 2 cpu rev. 3.00 oct. 06, 2008 page 41 of 1080 rej09b0230-0300 2.5.4 logic operation instructions table 2.13 logic opera tion instructions instruction operation code execution cycles t bit and rm,rn rn & rm rn 0010nnnnmmmm1001 1 ? and #imm,r0 r0 & imm r0 11001001iiiiiiii 1 ? and.b #imm,@(r0,gbr) (r0 + gbr) & imm (r0 + gbr) 11001101iiiiiiii 3 ? not rm,rn ~rm rn 0110nnnnmmmm0111 1 ? or rm,rn rn | rm rn 0010nnnnmmmm1011 1 ? or #imm,r0 r0 | imm r0 11001011iiiiiiii 1 ? or.b #imm,@(r0,gbr) (r0 + gbr) | imm (r0 + gbr) 11001111iiiiiiii 3 ? tas.b @rn if (rn) is 0, 1 t; 1 msb of (rn) 0100nnnn00011011 4 test result tst rm,rn rn & rm; if the result is 0, 1 t 0010nnnnmmmm1000 1 test result tst #imm,r0 r0 & imm; if the result is 0, 1 t 11001000iiiiiiii 1 test result tst.b #imm,@(r0,gbr) (r0 + gbr) & imm; if the result is 0, 1 t 11001100iiiiiiii 3 test result xor rm,rn rn ^ rm rn 0010nnnnmmmm1010 1 ? xor #imm,r0 r0 ^ imm r0 11001010iiiiiiii 1 ? xor.b #imm,@(r0,gbr) (r0 + gbr) ^ imm (r0 + gbr) 11001110iiiiiiii 3 ?
section 2 cpu rev. 3.00 oct. 06, 2008 page 42 of 1080 rej09b0230-0300 2.5.5 shift instructions table 2.14 shift instructions instruction operation code execution cycles t bit rotl rn t rn msb 0100nnnn00000100 1 msb rotr rn lsb rn t 0100nnnn00000101 1 lsb rotcl rn t rn t 0100nnnn00100100 1 msb rotcr rn t rn t 0100nnnn00100101 1 lsb shal rn t rn 0 0100nnnn00100000 1 msb shar rn msb rn t 0100nnnn00100001 1 lsb shll rn t rn 0 0100nnnn00000000 1 msb shlr rn 0 rn t 0100nnnn00000001 1 lsb shll2 rn rn << 2 rn 0100nnnn00001000 1 ? shlr2 rn rn >> 2 rn 0100nnnn00001001 1 ? shll8 rn rn << 8 rn 0100nnnn00011000 1 ? shlr8 rn rn >> 8 rn 0100nnnn00011001 1 ? shll16 rn rn << 16 rn 0100nnnn00101000 1 ? shlr16 rn rn >> 16 rn 0100nnnn00101001 1 ?
section 2 cpu rev. 3.00 oct. 06, 2008 page 43 of 1080 rej09b0230-0300 2.5.6 branch instructions table 2.15 branch instructions instruction operation code execution cycles t bit bf label if t = 0, disp 2 + pc pc; if t = 1, nop 10001011dddddddd 3/1 * ? bf/s label delayed branch, if t = 0, disp 2 + pc pc; if t = 1, nop 10001111dddddddd 2/1 * ? bt label if t = 1, disp 2 + pc pc; if t = 0, nop 10001001dddddddd 3/1 * ? bt/s label delayed branch, if t = 1, disp 2 + pc pc; if t = 0, nop 10001101dddddddd 2/1 * ? bra label delayed branch, disp 2 + pc pc 1010dddddddddddd 2 ? braf rm delayed branch, rm + pc pc 0000mmmm00100011 2 ? bsr label delayed branch, pc pr, disp 2 + pc pc 1011dddddddddddd 2 ? bsrf rm delayed branch, pc pr, rm + pc pc 0000mmmm00000011 2 ? jmp @rm delayed branch, rm pc 0100mmmm00101011 2 ? jsr @rm delayed branch, pc pr, rm pc 0100mmmm00001011 2 ? rts delayed branch, pr pc 0000000000001011 2 ? note: * one cycle when the branch is not executed.
section 2 cpu rev. 3.00 oct. 06, 2008 page 44 of 1080 rej09b0230-0300 2.5.7 system control instructions table 2.16 system co ntrol instructions instruction operation code execution cycles t bit clrt 0 t 0000000000001000 1 0 clrmac 0 mach, macl 0000000000101000 1 ? ldc rm,sr rm sr 0100mmmm00001110 6 lsb ldc rm,gbr rm gbr 0100mmmm00011110 4 ? ldc rm,vbr rm vbr 0100mmmm00101110 4 ? ldc.l @rm+,sr (rm) sr, rm + 4 rm 0100mmmm00000111 8 lsb ldc.l @rm+,gbr (rm) gbr, rm + 4 rm 0100mmmm00010111 4 ? ldc.l @rm+,vbr (rm) vbr, rm + 4 rm 0100mmmm00100111 4 ? lds rm,mach rm mach 0100mmmm00001010 1 ? lds rm,macl rm macl 0100mmmm00011010 1 ? lds rm,pr rm pr 0100mmmm00101010 1 ? lds.l @rm+,mach (rm) mach, rm + 4 rm 0100mmmm00000110 1 ? lds.l @rm+,macl (rm) macl, rm + 4 rm 0100mmmm00010110 1 ? lds.l @rm+,pr (rm) pr, rm + 4 rm 0100mmmm00100110 1 ? nop no operation 0000000000001001 1 ? rte delayed branch, stack area pc/sr 0000000000101011 5 ? sett 1 t 0000000000011000 1 1 sleep sleep 0000000000011011 4 * ? stc sr,rn sr rn 0000nnnn00000010 1 ? stc gbr,rn gbr rn 0000nnnn00010010 1 ? stc vbr,rn vbr rn 0000nnnn00100010 1 ? stc.l sr,@ ? rn rn?4 rn, sr (rn) 0100nnnn00000011 1 ? stc.l gbr,@ ? rn rn?4 rn, gbr (rn) 0100nnnn00010011 1 ? stc.l vbr,@ ? rn rn?4 rn, vbr (rn) 0100nnnn00100011 1 ?
section 2 cpu rev. 3.00 oct. 06, 2008 page 45 of 1080 rej09b0230-0300 instruction operation code execution cycles t bit sts mach,rn mach rn 0000nnnn00001010 1 ? sts macl,rn macl rn 0000nnnn00011010 1 ? sts pr,rn pr rn 0000nnnn00101010 1 ? sts.l mach,@ ? rn rn?4 rn, mach (rn) 0100nnnn00000010 1 ? sts.l macl,@ ? rn rn?4 rn, macl (rn) 0100nnnn00010010 1 ? sts.l pr,@ ? rn rn?4 rn, pr (rn) 0100nnnn00100010 1 ? trapa #imm pc / sr stack area, (imm 4 + vbr) pc 11000011iiiiiiii 8 ? note: * number of execution cycles until this lsi enters sleep mode. about the number of execution cycles: the table lists the minimum number of execution cycles. in practice, the number of execution cycles will be increased depending on the conditions such as: ? when there is a conflict between instruction fetch and data access ? when the destination register of a load instruction (memory register) is also used by the instruction immediately after the load instruction.
section 2 cpu rev. 3.00 oct. 06, 2008 page 46 of 1080 rej09b0230-0300 2.6 processing states the cpu has the five processing states: reset, ex ception handling, bus release, program execution, and power-down. figure 2.4 shows the cpu state transition. from any state when res = 0 and hstby = 1 hstby = 1, res = 0 hstby = 1, res = 0 from any state except deep software standby mode when res = 1, mres = 0, and hstby = 1 power-on reset state manual reset state res = 0 reset state res = 1 res = 1, mres = 1 when internal power-on reset by wdt or internal manual reset by wdt occurs exception handlin g state exception processin g source occurs exception processin g ends pro g ram execution state nmi interrupt or irq interrupt occurs bus release state bus request g enerated bus request cleared bus request g enerated bus request cleared bus request g enerated bus request cleared sleep mode ssby bit = 1 and stbymd bit = 1 for sleep instruction ssby bit = 1 and stbymd bit = 0 for sleep instruction ssby bit = 0 for sleep instruction software standby mode power-down mode deep software standby mode hardware standby mode from any state when hstby = 0 figure 2.4 transitions between processing states
section 2 cpu rev. 3.00 oct. 06, 2008 page 47 of 1080 rej09b0230-0300 ? reset state the cpu is reset. when the hstby pin is high and the res pin is low, the cpu enters the power-on reset state. when the hstby and res pins are high and mres pin is low, the cpu enters the manual reset state. ? exception handling state this state is a transitional state in which the cp u processing state changes due to a request for exception handling such as a reset or an interrupt. when a reset occurs, the execution start address as the initial value of the program counter (pc) and the initial value of the stack pointer (sp) are fetched from the exception handling vector table. then, a branch is made fo r the start address to execute a program. when an interrupt occurs, the pc and status regist er (sr) are saved in the stack area pointed to by sp. the start address of an exception hand ling routine is fetched from the exception handling vector table and a branch to the address is made to execute a program. then the processing state enters the program execution state. ? program execution state the cpu executes programs sequentially. ? power-down state the cpu stops to reduce power consumption. the sleep instruction makes the cpu enter sleep mode, software standby mode, or deep software standby mode. if the hstby pin is driven low, the cp u will enter the hardware standby mode. ? bus release state in the bus release state, the cpu releases access rights to the bus to the device that has requested them.
section 2 cpu rev. 3.00 oct. 06, 2008 page 48 of 1080 rej09b0230-0300
section 3 mcu operating modes rev. 3.00 oct. 06, 2008 page 49 of 1080 rej09b0230-0300 section 3 mcu operating modes 3.1 selection of operating modes this lsi has three mcu operating modes and three on-chip flash memory programming modes. the operating mode is determined by the setting of fwe, md1, and md0 pins. table 3.1 shows the allowable combinations of these pin settings; do not set these pins in the other way than the shown combinations. when power is applied to the system, be sure to conduct power-on reset. the mcu operating mode can be selected from mcu extension modes 0 and 2 and single chip mode. for the on-chip flash memory programming mode, boot mode, user boot mode, and user program mode which are on-chip programming modes are available. table 3.1 selection of operating modes pin setting mode no. fwe md1 md0 mode name on-chip rom bus width of cs0 space mode 0 0 0 0 mcu extension mode 0 not active 8 mode 2 0 1 0 mcu extension mode 2 active set by cs0bcr in bsc mode 3 0 1 1 single chip mode active ? mode 4 * 1 0 0 boot mode active ? mode 5 * 1 0 1 user boot mode active set by cs0bcr in bsc mode 6 * 1 1 0 user program mode active set by cs0bcr in bsc mode 7 * 1 1 1 ? note: * flash memory program mode.
section 3 mcu operating modes rev. 3.00 oct. 06, 2008 page 50 of 1080 rej09b0230-0300 3.2 input/output pins table 3.2 describes the configurati on of operating mode related pin. table 3.2 pin configuration pin name input/output function md0 input designates operating mode through the level applied to this pin md1 input designates operating mode through the level applied to this pin fwe input enables, by hardware, progr amming/erasing of the on-chip flash memory
section 3 mcu operating modes rev. 3.00 oct. 06, 2008 page 51 of 1080 rej09b0230-0300 3.3 operating modes 3.3.1 mode 0 (mcu extension mode 0) cs0 space becomes external memory spaces with 8-bit bus width. 3.3.2 mode 2 (mcu extension mode 2) the on-chip rom is active and cs0 space can be used in this mode. 3.3.3 mode 3 (single chip mode) all ports can be used in this mode, however the external address cannot be used.
section 3 mcu operating modes rev. 3.00 oct. 06, 2008 page 52 of 1080 rej09b0230-0300 3.4 address map the address maps for the operating modes are shown in figures 3.1 to 3.4. h'00000000 h'0003ffff h'00040000 h'ffff8fff h'ffff9000 h'ffffbfff h'ffffc000 h'ffffffff h'00000000 h'02000000 h'01ffffff h'03ffffff h'0003ffff h'07ffffff h'04000000 h'00040000 h'08000000 h'ffff8fff h'ffff9000 h'ffffbfff h'ffffc000 h'ffffffff h'00000000 h'03ffffff h'07ffffff h'04000000 h'08000000 h'ffff8fff h'ffff9000 h'ffffbfff h'ffffc000 h'ffffffff on-chip rom (256 kbytes) mode 0 on-chip rom disabled mode mode 2 on-chip rom enabled mode mode 3 sin g le chip mode on-chip ram (12 kbytes) reserved area reserved area cs0 space cs1 space on-chip peripheral i/o re g isters on-chip rom (256 kbytes) on-chip ram (12 kbytes) reserved area on-chip peripheral i/o re g isters on-chip ram (12 kbytes) reserved area cs0 space cs1 space on-chip peripheral i/o re g isters figure 3.1 address map for each operating mode (256-kbyte on-chip rom/12-kbyte on-chip ram version)
section 3 mcu operating modes rev. 3.00 oct. 06, 2008 page 53 of 1080 rej09b0230-0300 h'00000000 h'0003ffff h'00040000 h'ffff7fff h'ffff8000 h'ffffbfff h'ffffc000 h'ffffffff h'00000000 h'02000000 h'01ffffff h'03ffffff h'0003ffff h'07ffffff h'04000000 h'00040000 h'08000000 h'ffff7fff h'ffff8000 h'ffffbfff h'ffffc000 h'ffffffff h'00000000 h'03ffffff h'07ffffff h'04000000 h'08000000 h'ffff7fff h'ffff8000 h'ffffbfff h'ffffc000 h'ffffffff on-chip rom (256 kbytes) mode 0 on-chip rom disabled mode mode 2 on-chip rom enabled mode mode 3 sin g le chip mode on-chip ram (16 kbytes) reserved area reserved area cs0 space cs1 space on-chip peripheral i/o re g isters on-chip rom (256 kbytes) on-chip ram (16 kbytes) reserved area on-chip peripheral i/o re g isters on-chip ram (16 kbytes) reserved area cs0 space cs1 space on-chip peripheral i/o re g isters figure 3.2 address map for each operating mode (256-kbyte on-chip rom/16-kbyte on-chip ram version)
section 3 mcu operating modes rev. 3.00 oct. 06, 2008 page 54 of 1080 rej09b0230-0300 h'00000000 h'0005ffff h'00060000 h'ffff7fff h'ffff8000 h'ffffbfff h'ffffc000 h'ffffffff h'00000000 h'02000000 h'01ffffff h'03ffffff h'0005ffff h'07ffffff h'04000000 h'00060000 h'08000000 h'ffff7fff h'ffff8000 h'ffffbfff h'ffffc000 h'ffffffff h'00000000 h'03ffffff h'07ffffff h'04000000 h'08000000 h'ffff7fff h'ffff8000 h'ffffbfff h'ffffc000 h'ffffffff on-chip rom (384 kbytes) mode 0 on-chip rom disabled mode mode 2 on-chip rom enabled mode mode 3 sin g le chip mode on-chip ram (16 kbytes) reserved area reserved area cs0 space cs1 space on-chip peripheral i/o re g isters on-chip rom (384 kbytes) on-chip ram (16 kbytes) reserved area on-chip peripheral i/o re g isters on-chip ram (16 kbytes) reserved area cs0 space cs1 space on-chip peripheral i/o re g isters figure 3.3 address map for each operating mode (384-kbyte on-chip rom/16-kbyte on-chip ram version)
section 3 mcu operating modes rev. 3.00 oct. 06, 2008 page 55 of 1080 rej09b0230-0300 h'00000000 h'0007ffff h'00080000 h'ffff7fff h'ffff8000 h'ffffbfff h'ffffc000 h'ffffffff h'00000000 h'02000000 h'01ffffff h'03ffffff h'0007ffff h'07ffffff h'04000000 h'00080000 h'08000000 h'ffff7fff h'ffff8000 h'ffffbfff h'ffffc000 h'ffffffff h'00000000 h'03ffffff h'07ffffff h'04000000 h'08000000 h'ffff7fff h'ffff8000 h'ffffbfff h'ffffc000 h'ffffffff on-chip rom (512 kbytes) mode 0 on-chip rom disabled mode mode 2 on-chip rom enabled mode mode 3 sin g le chip mode on-chip ram (16 kbytes) reserved area reserved area cs0 space cs1 space on-chip peripheral i/o re g isters on-chip rom (512 kbytes) on-chip ram (16 kbytes) reserved area on-chip peripheral i/o re g isters on-chip ram (16 kbytes) reserved area cs0 space cs1 space on-chip peripheral i/o re g isters figure 3.4 address map for each operating mode (512-kbyte on-chip rom/16-kbyte on-chip ram version)
section 3 mcu operating modes rev. 3.00 oct. 06, 2008 page 56 of 1080 rej09b0230-0300 3.5 initial state in this lsi in the initial state of this lsi, some of on-chi p modules are set in module standby state for saving power. when operating these modules, clear module standby state according to the procedure in section 22, power-down modes. 3.6 note on changing operating mode when changing operating mode while power is applied to this lsi, make sure to do it in the power-on reset state (that is, the low level is applied to the res pin). note: * see section 25.3.2, control si g nal timin g . t mds * ck md1, md0 res figure 3.5 reset input timing when changing operating mode
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 57 of 1080 rej09b0230-0300 section 4 clock pulse generator (cpg) this lsi has a clock pulse generator (cpg) that generates an internal clock (i ), a bus clock (b ), a peripheral clock (p ), and clocks (mi and mp ) for the mtu2s and mtu2 modules. the cpg also controls power-down modes. 4.1 features ? five clocks generated independently an internal clock (i ) for the cpu; a peripheral clock (p ) for the on-chip peripheral modules; a bus clock (b = ck) for the external bus interface; a mtu2s clock (mi ) for the on-chip mtu2s module; and a mtu2 clock (mp ) for the on-chip mtu2 module. ? frequency change function frequencies of the internal clock (i ), bus clock (b ), peripheral clock (p ), mtu2s clock (mi ), and mtu2 clock (mp ) can be changed independently using the divider circuit within the cpg. frequencies are changed by software using the frequency control register (frqcr) setting. ? power-down mode control the clock can be stopped in sleep mode and standby mode and specific modules can be stopped using the module standby function. ? oscillation stop detection if the clock supplied through the clock input pin stops for any reason, the timer pins can be automatically placed in th e high-impedance state.
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 58 of 1080 rej09b0230-0300 figure 4.1 shows a block diagram of the clock pulse generator. ck pll circuit ( 8) oscillator unit internal clock (i ) internal bus bus interface frqcr: osccr: stbcr1: stbcr2: stbcr3: stbcr4: stbcr5: stbcr6: frequency control re g ister oscillation stop detection control re g ister standby control re g ister 1 standby control re g ister 2 standby control re g ister 3 standby control re g ister 4 standby control re g ister 5 standby control re g ister 6 peripheral clock (p ) bus clock (b = ck) extal xtal frqcr osccr stbcr2 stbcr1 stbcr3 stbcr4 stbcr5 stbcr6 cpg control unit mtu2 clock (mp ) mtu2s clock (mi ) clock frequency control circuit standby control circuit [le g end] 1 1/2 1/3 1/4 1/8 divider oscillation stop detection oscillation stop detection circuit crystal oscillator figure 4.1 block diagram of clock pulse generator
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 59 of 1080 rej09b0230-0300 the clock pulse generator blocks function as follows: pll circuit: the pll circuit multiples the clock freque ncy input from the crystal oscillator or the extal pin by 8. the multiplication ratio is fixed at 8. crystal oscillator: the crystal oscillator is an oscillator circuit when a crystal resonator is connected to the xtal and extal pins. divider: the divider generates clocks with the frequencies to be used by the internal clock (i ), bus clock (b ), peripheral clock (p ), mtu2s clock (mi ), and mtu2 clock (mp ). the frequencies can be selected from 1, 1/2, 1/3, 1/4, and 1/8 times the frequency output from the pll circuit. the division ratio should be specified in the frequency control register (frqcr). oscillation stop detection circuit: this circuit detects an a bnormal condition in the crystal oscillator. clock frequency control circuit: the clock frequency control circuit controls the clock frequency according to the setting in the frequency control register (frqcr). standby control circuit: the standby control circuit controls the state of the on-chip oscillator circuit and other modules in sleep or standby mode. frequency control register (frqcr): the frequency control register (frqcr) has control bits for the frequency division ratios of the internal clock (i ), bus clock (b ), peripheral clock (p ), mtu2s clock (mi ), and mtu2 clock (mp ). oscillation stop detectio n control register (osccr): the oscillation stop detection control register (osccr) has an oscillation stop detection flag and a bit for selecting flag status output through an external pin. standby control registers 1 to 6 (stbcr1 to stbcr6): the standby control register (stbcr) has bits for controlling the power-down modes. for details, see section 22, power-down modes.
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 60 of 1080 rej09b0230-0300 table 4.1 shows the operatin g clock for each module. table 4.1 operating clock for each module operating clock operating module operating clock operating module internal clock (i ) cpu peripheral clock (p ) poe ubc sci rom synchronous serial communication unit ram a/d aud cmt rcan-et wdt bus clock (b ) bsc mtu2 clock (mp ) mtu2 dtc mtu2s clock (mi ) mtu2s
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 61 of 1080 rej09b0230-0300 4.2 input/output pins table 4.2 shows the cpg pin configuration. table 4.2 pin configuration pin name symbol i/o description xtal output connects a crystal resonator. crystal input/output pins (clock input pins) extal input connects a crystal resonator or an external clock. clock output pin ck output outputs an external clock. note: to use the clock output (ck) pin, appropriate settings may be needed for the pin in the pin function controller (pfc) in some cases. for details, refer to section 18, pin function controller (pfc).
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 62 of 1080 rej09b0230-0300 4.3 clock operating mode table 4.3 shows the clock operating mode of this lsi. table 4.3 clock operating mode clock i/o clock operating mode source output pll circuit input to divider 1 extal input or crystal resonator ck * on ( 8) 8 note: * to output the clock through the clock output (ck) pin, appropriate settings should be made in the pin function controller (pfc). for details, refer to section 18, pin function controller (pfc). mode 1: the frequency of the external clock input from the extal pin is multiplied by 8 in the pll circuit before being supplied to the on-chip modules in this lsi, which eliminates the need to generate a high-frequency clock outside the lsi. since the input clock frequency ranging from 8 mhz to 10 mhz can be used, the internal clock (i ) frequency ranges from 10 mhz to 80 mhz. maximum operating frequencies: i = 80 mhz, b = 40 mhz, p = 40 mhz, mi = 80 mhz, and mp = 40 mhz (t opr = -40 to +85c) maximum operating frequencies: i = 64 mhz, b = 32 mhz, p = 32 mhz, mi = 64 mhz, and mp = 32 mhz (t opr = ? 40 to + 125 c) table 4.4 shows the frequency division ratios that can be specified with frqcr.
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 63 of 1080 rej09b0230-0300 table 4.4 frequency division ratios specifiable with frqcr frqcr division ratio setting clock ratio clock frequency (mhz) * pll multipli- cation ratio i b p mi mp i b p mi mp input clock i b p mi mp 8 1/4 1/4 1/8 1/8 1/8 2 2 1 1 1 10 20 20 10 10 10 1/4 1/4 1/8 1/4 1/8 2 2 1 2 1 20 20 10 20 10 1/4 1/4 1/8 1/4 1/4 2 2 1 2 2 20 20 10 20 20 1/4 1/4 1/4 1/4 1/4 2 2 2 2 2 20 20 20 20 20 1/3 1/3 1/3 1/3 1/3 8/3 8/3 8/3 8/3 8/3 26 26 26 26 26 1/2 1/4 1/8 1/8 1/8 4 2 1 1 1 40 20 10 10 10 1/2 1/4 1/8 1/4 1/8 4 2 1 2 1 40 20 10 20 10 1/2 1/4 1/8 1/4 1/4 4 2 1 2 2 40 20 10 20 20 1/2 1/4 1/8 1/2 1/8 4 2 1 4 1 40 20 10 40 10 1/2 1/4 1/8 1/2 1/4 4 2 1 4 2 40 20 10 40 20 1/2 1/4 1/4 1/4 1/4 4 2 2 2 2 40 20 20 20 20 1/2 1/4 1/4 1/2 1/4 4 2 2 4 2 40 20 20 40 20 1/2 1/2 1/8 1/8 1/8 4 4 1 1 1 40 40 10 10 10 1/2 1/2 1/8 1/4 1/8 4 4 1 2 1 40 40 10 20 10 1/2 1/2 1/8 1/4 1/4 4 4 1 2 2 40 40 10 20 20 1/2 1/2 1/8 1/2 1/8 4 4 1 4 1 40 40 10 40 10 1/2 1/2 1/8 1/2 1/4 4 4 1 4 2 40 40 10 40 20 1/2 1/2 1/8 1/2 1/2 4 4 1 4 4 40 40 10 40 40 1/2 1/2 1/4 1/4 1/4 4 4 2 2 2 40 40 20 20 20 1/2 1/2 1/4 1/2 1/4 4 4 2 4 2 40 40 20 40 20 1/2 1/2 1/4 1/2 1/2 4 4 2 4 4 40 40 20 40 40 1/2 1/2 1/2 1/2 1/2 4 4 4 4 4 40 40 40 40 40 1/1 1/4 1/8 1/8 1/8 8 2 1 1 1 80 20 10 10 10 1/1 1/4 1/8 1/4 1/8 8 2 1 2 1 80 20 10 20 10 1/1 1/4 1/8 1/4 1/4 8 2 1 2 2 80 20 10 20 20 1/1 1/4 1/8 1/2 1/8 8 2 1 4 1 80 20 10 40 10 1/1 1/4 1/8 1/2 1/4 8 2 1 4 2 80 20 10 40 20 1/1 1/4 1/8 1/1 1/8 8 2 1 8 1 80 20 10 80 10
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 64 of 1080 rej09b0230-0300 frqcr division ratio setting clock ratio clock frequency (mhz) * pll multipli- cation ratio i b p mi mp i b p mi mp input clock i b p mi mp 8 1/1 1/4 1/8 1/1 1/4 8 2 1 8 2 10 80 20 10 80 20 1/1 1/4 1/4 1/4 1/4 8 2 2 2 2 80 20 20 20 20 1/1 1/4 1/4 1/2 1/4 8 2 2 4 2 80 20 20 40 20 1/1 1/4 1/4 1/1 1/4 8 2 2 8 2 80 20 20 80 20 1/1 1/3 1/3 1/3 1/3 8 8/3 8/3 8/3 8/3 80 26 26 26 26 1/1 1/3 1/3 1/1 1/3 8 8/3 8/3 8 8/3 80 26 26 80 26 1/1 1/2 1/8 1/8 1/8 8 4 1 1 1 80 40 10 10 10 1/1 1/2 1/8 1/4 1/8 8 4 1 2 1 80 40 10 20 10 1/1 1/2 1/8 1/4 1/4 8 4 1 2 2 80 40 10 20 20 1/1 1/2 1/8 1/2 1/8 8 4 1 4 1 80 40 10 40 10 1/1 1/2 1/8 1/2 1/4 8 4 1 4 2 80 40 10 40 20 1/1 1/2 1/8 1/2 1/2 8 4 1 4 4 80 40 10 40 40 1/1 1/2 1/8 1/1 1/8 8 4 1 8 1 80 40 10 80 10 1/1 1/2 1/8 1/1 1/4 8 4 1 8 2 80 40 10 80 20 1/1 1/2 1/8 1/1 1/2 8 4 1 8 4 80 40 10 80 40 1/1 1/2 1/4 1/4 1/4 8 4 2 2 2 80 40 20 20 20 1/1 1/2 1/4 1/2 1/4 8 4 2 4 2 80 40 20 40 20 1/1 1/2 1/4 1/2 1/2 8 4 2 4 4 80 40 20 40 40 1/1 1/2 1/4 1/1 1/4 8 4 2 8 2 80 40 20 80 20 1/1 1/2 1/4 1/1 1/2 8 4 2 8 4 80 40 20 80 40 1/1 1/2 1/2 1/2 1/2 8 4 4 4 4 80 40 40 40 40 1/1 1/2 1/2 1/1 1/2 8 4 4 8 4 80 40 40 80 40
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 65 of 1080 rej09b0230-0300 notes: * clock frequencies when the input clock frequency is assumed to be the shown value. 1. the pll multiplication ratio is fixed at 8. the division ratio can be selected from 1, 1/2, 1/3, 1/4, and 1/8 for each clock by the setting in the frequency control register. 2. the output frequency of the pll circuit is the product of the frequency of the input from the crystal resonator or extal pin and the multiplication ratio ( 8) of the pll circuit. 3. the input to the divider is always the output from the pll circuit. 4. the internal clock (i ) frequency is the product of the frequency of the input from the crystal resonator or extal pin, the multiplication ratio ( 8) of the pll circuit, and the division ratio of the divider. the resultant frequency must be a maximum of 80 mhz (maximum operating frequency). 5. the bus clock (b ) frequency is the product of the frequency of the input from the crystal resonator or extal pin, the multiplication ratio ( 8) of the pll circuit, and the division ratio of the divider. the resultant frequency must be a maximum of 40 mhz and equal to or lower than the internal clock (i ) frequency. 6. the peripheral clock (p ) frequency is the product of the frequency of the input from the crystal resonator or extal pin, the multiplication ratio ( 8) of the pll circuit, and the division ratio of the divider. the resultant frequency must be a maximum of 40 mhz and equal to or lower than the bus clock (b ) frequency. 7. when using the mtu2s and mtu2, the mtu2s clock (mi ) frequency must be equal to or lower than the internal clock (i ) frequency and equal to or higher than the mtu2 clock (mp ) frequency. the mtu2 clock (mp ) frequency must be equal to or lower than the mtu2s clock (mi ) frequency and the bus clock (b ) frequency, and equal to or higher than the peripheral clock (p ) frequency. the mtu2s clock (mi ) frequency and mtu2 clock (mp ) frequency are the product of the frequency of the input from the crystal resonator or extal pin, the multiplication ratio ( 8) of the pll circuit, and the division ratio of the divider. 8. the frequency of the ck pin is always be equal to the bus clock (b ) frequency.
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 66 of 1080 rej09b0230-0300 4.4 register descriptions the cpg has the following registers. for details on the addresses of these registers and the states of these registers in each processing state, see section 24, list of registers. table 4.5 register configuration register name abbrevia- tion r/w initial value address access size frequency control register frqcr r/w h'36db h'ffffe800 16 oscillation stop detection control register osccr r/w h'00 h'ffffe814 8 4.4.1 frequency control register (frqcr) frqcr is a 16-bit readable/writable register that specifies the frequency division ratios for the internal clock (i ), bus clock (b ), peripheral clock (p ), mtu2s clock (mi ), and mtu2 clock (mp ). frqcr can be accessed only in words. frqcr is initialized to h'36db only by a power-on reset (except a power-on reset due to a wdt overflow). bit: initial value: r/w: 151413121110987654321 0 0011011011011011 r r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w - ifc[2:0] bfc[2:0] pfc[2:0] mifc[2:0] mpfc[2:0]
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 67 of 1080 rej09b0230-0300 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 to 12 ifc[2:0] 011 r/w internal clock (i ) frequency division ratio specify the division ratio of the internal clock (i ) frequency with respect to the output frequency of pll circuit. if a prohibited value is specified, subsequent operation is not guaranteed. 000: 1 001: 1/2 010: 1/3 011: 1/4 100: 1/8 other than above: setting prohibited 11 to 9 bfc[2:0] 011 r/w bus clock (b ) frequency division ratio specify the division ratio of the bus clock (b ) frequency with respect to the output frequency of pll circuit. if a prohibited value is specified, subsequent operation is not guaranteed. 000: 1 001: 1/2 010: 1/3 011: 1/4 100: 1/8 other than above: setting prohibited
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 68 of 1080 rej09b0230-0300 bit bit name initial value r/w description 8 to 6 pfc[2:0] 011 r/w peripheral clock (p ) frequency division ratio specify the division ratio of the peripheral clock (p ) frequency with respect to the output frequency of pll circuit. if a prohibited value is specified, subsequent operation is not guaranteed. 000: 1 001: 1/2 010: 1/3 011: 1/4 100: 1/8 other than above: setting prohibited 5 to 3 mifc[2:0] 011 r/w mtu2s clock (mi ) frequency division ratio specify the division ratio of the mtu2s clock (mi ) frequency with respect to the output frequency of pll circuit. if a prohibited value is specified, subsequent operation is not guaranteed. 000: 1 001: 1/2 010: 1/3 011: 1/4 100: 1/8 other than above: setting prohibited 2 to 0 mpfc[2:0] 011 r/w mtu2 clock (mp ) frequency division ratio specify the division ratio of the mtu2 clock (mp ) frequency with respect to the output frequency of pll circuit. if a prohibited value is specified, subsequent operation is not guaranteed. 000: 1 001: 1/2 010: 1/3 011: 1/4 100: 1/8 other than above: setting prohibited
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 69 of 1080 rej09b0230-0300 4.4.2 oscillation stop detectio n control register (osccr) osccr is an 8-bit readable/writable register that has an oscillation stop detection flag and selects flag status output to an external pin. osccr can be accessed only in bytes. bit: initial value: r/w: 7654321 0 00000000 rrrrrrrr/w ----- osc stop - osc ers bit bit name initial value r/w description 7 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 oscstop 0 r oscillation stop detection flag [setting conditions] ? when a stop in the clock input is detected during normal operation ? when software standby mode is entered [clearing conditions] ? by a power-on reset input through the res pin ? when software standby mode is canceled 1 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 0 oscers 0 r/w oscillation stop detection flag output select selects whether to output the oscillation stop detection flag signal through the wdtovf pin. 0: outputs only the wdt overflow signal through the wdtovf pin 1: outputs the wdt overflow signal and the oscillation stop detection flag signal through the wdtovf pin
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 70 of 1080 rej09b0230-0300 4.5 changing frequency selecting division ratios for the frequency divider ca n change the frequencies of the internal clock (i ), bus clock (b ), peripheral clock (p ), mtu2s clock (mi ), and mtu2 clock (mp ). this is controlled by software through the frequency control register (frqcr). the following describes how to specify the frequencies. 1. in the initial state, ifc2 to ifc0 = h'011 ( 1/4), bfc2 to bfc0 = h'011 ( 1/4), pfc2 to pfc0 = h'011 ( 1/4), mifc2 to mifc0 = h'011 ( 1/4), and mpfc2 to mpfc0 = h'011 ( 1/4). 2. stop all modules except the cpu, on-chip rom, and on-chip ram. 3. set the desired values in bits ifc2 to ifc0, bfc2 to bfc0, pfc2 to pfc0, mifc2 to mifc0, and mpfc2 to mpfc0 bits. since the frequency mu ltiplication ratio in the pll circuit is fixed at 8, the frequencies are determined only be selecting division ratios. when specifying the frequencies, satisfy the following condition: internal clock (i ) bus clock (b ) peripheral clock (p ). when using the mtu2s clock and mtu2 clock, specify the frequencies to satisfy the following condition: internal clock (i ) mtu2s clock (mi ) mtu2 clock (mp ) peripheral clock (p ) and bus clock (b ) mtu2 clock (mp ). code to rewrite values of frqcr should be executed in the on-chip rom or on-chip ram. 4. after an instruction to rewrite frqcr has been issued, the actual clock frequencies will change after (1 to 24n) cyc + 11b + 7p . n: division ratio specified by the bfc bit in frqcr (1, 1/2, 1/3, 1/4, or 1/8) cyc: clock obtained by dividing extal by 8 with the pll. note: (1 to 24n) depends on the internal state.
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 71 of 1080 rej09b0230-0300 4.6 oscillator clock pulses can be supplied from a connected crystal resonator or an external clock. 4.6.1 connecting crystal resonator a crystal resonator can be connected as shown in figure 4.2. use the damping resistance (rd) listed in table 4.6. use a crystal resonator that has a resonance frequency of 8 to 10 mhz. it is recommended to consult the crystal resonator manufacturer concerning the compatibility of the crystal resonator and the lsi. extal xtal r d c l2 c l1 c l1 = c l2 = 18 to 22 pf (reference values) figure 4.2 connection of crystal resonator (example) table 4.6 damping resistan ce values (reference values) frequency (mhz) 8 10 rd ( ) (reference values) 200 0 figure 4.3 shows an equivalent circuit of the crystal resonator. use a crystal resonator with the characteristics listed in table 4.7. xtal c l extal c 0 l r s figure 4.3 crystal resonator equivalent circuit
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 72 of 1080 rej09b0230-0300 table 4.7 crystal resonator characteristics frequency (mhz) 8 10 rs max. ( ) (reference values) 80 60 c 0 max. (pf) (reference values) 7 7 4.6.2 external clock input method figure 4.4 shows an example of an external clock input connection. in this case, make the external clock high level to stop it when in software st andby mode. during operation, make the external input clock frequency 8 to 10 mhz. when leaving the xtal pin open, make sure the parasitic capacitance is less than 10 pf. even when inputting an external clock, be sure to wait at least the oscillation stabilization time in power-on sequence or in releasing software standby mode, in order to ensure the pll stabilization time. extal xtal external clock input open state figure 4.4 example of external clock connection
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 73 of 1080 rej09b0230-0300 4.7 function for detecting oscillator stop this cpg detects a stop in the clock input if any system abnormality halts the clock supply. when no change has been detected in the extal input for a certain period, the oscstop bit in osccr is set to 1 and this state is retain ed until a power-on reset is input through the res pin or software standby mode is canceled. if the oscers bit is set to 1 at this time, an oscillation stop detection flag signal is output through the wdtovf pin. in addition, the high-current ports (pins to which the tioc3b, tioc3d, and tioc4a to tioc4d signals in the mtu2 and the tioc3bs, tioc3ds, and tioc4as to tioc4ds signals in th e mtu2s are assigned) can be placed in high- impedance state regardless of the pfc setting. for details, refer to appendix a, pin states. even in software standby mode, these pins can be placed in high-impedance state. for details, refer to appendix a, pin states. these pins enter the normal state after software standby mode is canceled. under an abnormal condition where oscilla tion stops while the lsi is not in software standby mode, lsi operati ons other than the oscillation stop detection fu nction become unpredictable. in this case, even after oscillation is restarted, lsi operations including the above high-current pins become unpredictable. even while no change is detected in the extal input, the pll circuit in this lsi continues oscillating at a frequency range from 100 khz to 10 mhz (depending on the temperature and operating voltage).
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 74 of 1080 rej09b0230-0300 4.8 usage notes 4.8.1 note on crystal resonator a sufficient evaluation at the user?s site is nece ssary to use the lsi, by referring the resonator connection examples shown in this section, becau se various characteristics related to the crystal resonator are closely linked to the user?s board design. as the oscillator circuit's circuit constant will depend on the resonator and the floating capacita nce of the mounting circuit, the value of each external circuit?s component should be determined in consultation with the resonator manufacturer. the design must ensure that a volta ge exceeding the maximum rating is not applied to the oscillator pin. 4.8.2 notes on board design measures against radiation noise are taken in this lsi. if further reduction in radiation noise is needed, it is recommended to use a multiple layer board and provide a layer exclusive to the system ground. when using a crystal resonator, place the crystal resonator and its load capacitors as close as possible to the xtal and extal pins. do not route any signal lines near the oscillator circuitry as shown in figure 4.5. otherwise, correct oscillation can be interfered by induction. c l2 si g nal a si g nal b this lsi c l1 xtal extal avoid figure 4.5 cautions for oscillator circuit board design
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 75 of 1080 rej09b0230-0300 a circuitry shown in figure 4.6 is recommended as an external circuitry around the pll. separate the pll power lines (pllvss) and the system power lines (vcc, vss) at the board power supply source, and be sure to insert bypass capacitors cb and cpb close to the pins. pllv ss v cl v cc v ss cpb = 0.47 f * cb = 0.1 f * (recommended values are shown.) note: * cb and cpb are laminated ceramic type. figure 4.6 recommended external circuitry around pll
section 4 clock pulse generator (cpg) rev. 3.00 oct. 06, 2008 page 76 of 1080 rej09b0230-0300
section 5 exception handling rev. 3.00 oct. 06, 2008 page 77 of 1080 rej09b0230-0300 section 5 exception handling 5.1 overview 5.1.1 types of exception handling and priority exception handling is started by four sources: resets, address errors, interrupts and instructions and have the priority, as shown in table 5.1. when several exceptions are detected at once, they are processed according to the priority. table 5.1 types of exceptions and priority exception exception source priority reset power-on reset high manual reset interrupt user break (break before instruction execution) address error cpu address error (instruction fetch) instruction general illegal instructions (undefined code) illegal slot instruction (undefined code placed immediately after a delayed branch instruction * 1 or instruction that changes the pc value * 2 ) trap instruction (trapa instruction) address error cpu address error (data access) interrupt user break (break after instruction execution or operand break) address error dtc address error (data access) interrupt nmi irq on-chip peripheral modules low notes: 1. delayed branch instructions: jmp, jsr, bra, bsr, rts, rte, bf/s, bt/s, bsrf, and braf. 2. instructions that change the pc value: jmp, jsr, bra, bsr, rts, rte, bt, bf, trapa, bf/s, bt/s, bsrf, braf, ldc rm,sr, ldc.l @rm+,sr.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 78 of 1080 rej09b0230-0300 5.1.2 exception hand ling operations the exceptions are detected and the exception handling starts acco rding to the timing shown in table 5.2. table 5.2 timing for exception detection and start of exception handling exception timing of source detection and start of exception handling reset power-on reset started when the res pin changes from low to high or when the wdt overflows. manual reset started when the mres pin changes from low to high or when the wdt overflows. address error interrupt detected during the instruction decode stage and started after the execution of the current instruction is completed. instruction trap instruction started by the execution of the trapa instruction. general illegal instructions started when an undefined code placed at other than a delay slot (immediately after a delayed branch instruction) is decoded. illegal slot instructions started when an undefined code placed at a delay slot (immediately after a delayed branch instruction) or an instruction that changes the pc value is detected. when exception handling starts, the cpu operates exception handling triggered by reset: the initial values of the program counter (pc) and stack pointer (sp) are fetched from the exceptio n handling vector table (pc from the address h'00000000 and sp from the address h'00000004 when a power-on reset. pc from the address h'00000008 and sp from the address h'0000000c when a manual reset.). for details, see section 5.1.3, exception handling vector table. h'00000000 is then written to the vector base register (vbr), and h'f (b'1111) is written to the interrupt mask bits (i3 to i0) in the status register (sr). the program starts from the pc address fetched from the exception handling vector table. exception handling triggered by addres s error, interrupt , and instruction: sr and pc are saved to the stack indicated by r15. for interrupt exception handling, the interrupt priority level is written to the interrupt mask bits (i3 to i0) in sr. for address error and instruction exception handling, bits i3 to i0 are not affected. the start address is then fetched from the exception handling vector table and the program starts from that address.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 79 of 1080 rej09b0230-0300 5.1.3 exception handling vector table before exception handling starts, the exception handling vector table must be set in memory. the exception handling vector table stores the start addresses of exception handling routines. (the reset exception handling table holds the initial values of pc and sp.) all exception sources are given different vector numbers and vector table address offsets. the vector table addresses are calculated from these v ector numbers and vector table address offsets. during exception handling, the start addresses of the exception handling routines are fetched from the exception handling vector ta ble that is indicated by th is vector table address. table 5.3 shows the vector numbers and vector table address offsets. table 5.4 shows how vector table addresses are calculated. table 5.3 vector numbers and vector table address offsets exception handling source vector number vector table address offset power-on reset pc 0 h'00000000 to h'00000003 sp 1 h'00000004 to h'00000007 manual reset pc 2 h'00000008 to h'0000000b sp 3 h'0000000c to h'0000000f general illegal instruction 4 h'00000010 to h'00000013 (reserved for system use) 5 h'00000014 to h'00000017 illegal slot instruction 6 h'00000018 to h'0000001b (reserved for system use) 7 h'0000001c to h'0000001f 8 h'00000020 to h'00000023 cpu address error 9 h'00000024 to h'00000027 dtc address error 10 h'00000028 to h'0000002b interrupt nmi 11 h'0000002c to h'0000002f user break 12 h'00000030 to h'00000033 (reserved for system use) 13 h'00000034 to h'00000037 : : 31 h'0000007c to h'0000007f trap instruction (user vector) 32 h'00000080 to h'00000083 : : 63 h'000000fc to h'000000ff
section 5 exception handling rev. 3.00 oct. 06, 2008 page 80 of 1080 rej09b0230-0300 exception handling source vector number vector table address offset interrupt irq0 64 h'00000100 to h'00000103 irq1 65 h'00000104 to h'00000107 irq2 66 h'00000108 to h'0000010b irq3 67 h'0000010c to h'0000010f (reserved for system use) 68 h'00000110 to h'00000113 69 h'00000114 to h'00000117 70 h'00000118 to h'0000011b 71 h'0000011c to h'0000011f on-chip peripheral module * 72 h'00000120 to h'00000123 : : 255 h'000003fc to h'000003ff note: * for details on the vector numbers and vector table address offsets of on-chip peripheral module interrupts, see table 6.3. table 5.4 calculating exception handling vector table addresses exception source vector table address calculation resets vector table address = (vector table address offset) = (vector number) 4 address errors, interrupts, instructions vector table address = vbr + (vector table address offset) = vbr + (vector number) 4 notes: 1. vbr: vector base register 2. vector table address offset: see table 5.3. 3. vector number: see table 5.3.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 81 of 1080 rej09b0230-0300 5.2 resets 5.2.1 types of resets resets have priority over any exception source. th ere are two types of resets: power-on resets and manual resets. as table 5.5 shows, both types of resets initialize the internal status of the cpu. in power-on resets, all registers of the on-chip peripheral modules are initialized; in manual resets, they are not. table 5.5 reset status conditions for transition to reset state internal state type res wdt overflow mres cpu, intc on-chip peripheral module poe, pfc, i/o port low ? ? initialized initialized initialized power-on reset high overflow high initialized initialized initialized manual reset high not overflowed low initialized not initialized not initialized 5.2.2 power-on reset power-on reset by res pin: when the res pin is driven low, this lsi enters the power-on reset state. to reliably reset this lsi, the res pin should be kept low fo r at least the oscillation settling time when applying the power or when in standby mode (when the clock is halted) or at least 20 tcyc when the clock is operating. during the power-on reset state, cpu internal states and all registers of on-chip peripheral modules are initialized. see appendix a, pin states, for the status of individual pins during power-on reset mode. in the power-on reset state, power-on reset exception handling starts when driving the res pin high after driving the pin low for the given time. the cpu operates as follows: 1. the initial value (execution start address) of the program counter (pc) is fetched from the exception handling vector table. 2. the initial value of the stack pointer (sp) is fetched from the exception handling vector table. 3. the vector base register (vbr) is cleared to h'00000000 and the interrupt mask bits (i3 to i0) of the status register (sr) are set to h'f (b'1111). 4. the values fetched from the exception handling vector table are set in pc and sp, then the program starts.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 82 of 1080 rej09b0230-0300 be certain to always perform power-on reset exception handling when turning the system power on. power-on reset by wdt: when wtcnt of the wdt overflows while a setting is made so that a power-on reset can be generated in watchdog timer mode of the wdt, this lsi enters the power-on reset state. the frequency control register (frqcr) in the clock pulse generator (cpg) and the watchdog timer (wdt) registers are not initialized by the reset signal generated by the wdt (these registers are only initialized by a power-on reset by the res pin). if a reset caused by the signal input on the res pin and a reset caused by a wdt overflow occur simultaneously, the res pin reset has priority, and the wovf bit in wtcsr is cleared to 0. when the power-on reset exception handling caused by the wdt is started, the cpu operates as follows: 1. the initial value (execution start address) of the program counter (pc) is fetched from the exception handling vector table. 2. the initial value of the stack pointer (sp) is fetched from the exception handling vector table. 3. the vector base register (vbr) is cleared to h'00000000 and the interrupt mask bits (i3 to i0) of the status register (sr) are set to h'f (b'1111). 4. the values fetched from the exception handling vector table are set in the pc and sp, then the program starts. 5.2.3 manual reset when the res pin is high and the mres pin is driven low, the lsi becomes to be a manual reset state. to reliably reset the lsi, the mres pin should be kept at low for at least the duration of the oscillation settling time that is set in wdt when in software standby mode (when the clock is halted) or at least 20 t cyc when the clock is operating. during manual reset, the cpu internal status is initialized. registers of on-chip peripheral modules are not initialized. when the lsi enters manual reset status in the middle of a bus cycl e, manual reset exception processing does not start until the bus cycle has ended. thus, manual resets do not abort bus cycles. however, once mres is driven low, hold the low level until the cpu becomes to be a manual reset mode after the bus cycle ends. (keep at low level for at least the lo ngest bus cycle). see appendix a, pin states, for the status of individual pins during manual reset mode. in the manual reset status, manual reset exception processing starts when the mres pin is first kept low for a set period of time and then returned to high. the cpu will then operate in the same procedures as described for power-on resets.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 83 of 1080 rej09b0230-0300 5.3 address errors 5.3.1 address error sources address errors occur when instructions are fetched or data is read from or written to, as shown in table 5.6. table 5.6 bus cycles and address errors bus cycle type bus master bus cycle description address errors cpu instruction fetched from even address none (normal) instruction fetch instruction fetched from odd address address error occurs instruction fetched from a space other than on-chip peripheral module space none (normal) instruction fetched from on-chip peripheral module space address error occurs instruction fetched from external memory space in single chip mode address error occurs word data accessed from even address none (normal) data read/write cpu or dtc word data accessed from odd address address error occurs longword data accessed from a longword boundary none (normal) longword data accessed from other than a long-word boundary address error occurs byte or word data accessed in on-chip peripheral module space none (normal) longword data accessed in 16-bit on-chip peripheral module space none (normal) longword data accessed in 8-bit on-chip peripheral module space none (normal) external memory space accessed when in single chip mode address error occurs
section 5 exception handling rev. 3.00 oct. 06, 2008 page 84 of 1080 rej09b0230-0300 5.3.2 address error exception source when an address error exception is generated, the bus cycle which caused the address error ends, the current instruction finishes, and then the address error exception handling starts. the cpu operates as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value to be saved is the start address of the instruction which caus ed an address error exception. when the instruction that caused the exception is placed in the delay slot, the address of the delayed branch instruction which is placed immediat ely before the delay slot. 3. the start address of the exception handling routine is fetched from the exception handling vector table that corresponds to the generated address error, and the program starts executing from that address. this branch is not a delayed branch.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 85 of 1080 rej09b0230-0300 5.4 interrupts 5.4.1 interrupt sources table 5.7 shows the sources that start the interrupt exception handling. they are nmi, user break, irq, and on-chip peripheral modules. table 5.7 interrupt sources type request source number of sources nmi nmi pin (external input) 1 user break user break controller (ubc) 1 irq irq0 to irq3 pins (external input) 4 on-chip peripheral module multi-function timer pulse unit 2 (mtu2) 25 multi-function timer pulse unit 2s (mtu2s) 13 data transfer controller (dtc) 1 watchdog timer (wdt) 1 a/d converter (a/d_0 and a/d_1) 2 compare match timer (cmt_0 and cmt_1) 2 serial communication interface (sci_0, sci_1, and sci_2) 12 synchronous serial communication unit 3 port output enable (poe) 3 controller area network (rcan-et) 5/10 * note: * available only in the sh7142. all interrupt sources are given different vector numbers and vector table address offsets. for details on vector numbers and vector table address offsets, see table 6.3.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 86 of 1080 rej09b0230-0300 5.4.2 interrupt priority the interrupt priority is predetermined. when multiple interrupts occur simultaneously (overlapped interruptions), the interrupt controller (intc) determines their relative priorities and starts the exception handling according to the results. the priority of interrupts is expressed as priority levels 0 to 16, with priority 0 the lowest and priority 16 the highest. the nmi interrupt has priority 16 and cannot be masked, so it is always accepted. the priority level of th e user break interrupt is 15. ir q interrupt and on-chip peripheral module interrupt priority levels can be set freely using the interrupt priority registers a, d to f, and h to m (ipra, iprd to iprf, and iprh to iprm) of the intc as shown in table 5.8. the priority levels that can be set are 0 to 15. level 16 cannot be set. for details on ipra, iprd to iprf, and iprh to iprm, see section 6.3.4, interrupt priority registers a, d to f, and h to m (ipra, iprd to iprf, and iprh to iprm). table 5.8 interrupt priority type priority level comment nmi 16 fixed priority level. cannot be masked. user break 15 fixed priority level. can be masked. irq on-chip peripheral module 0 to 15 set with interrupt priority registers a, d to f, and h to m (ipra, iprd to iprf, and iprh to iprm). 5.4.3 interrupt exception handling when an interrupt occurs, the interrupt controller (intc) ascertains its priority level. nmi is always accepted, but other interrupts are only accepted if they have a priority level higher than the priority level set in the interrupt mask bits (i3 to i0) of the status register (sr). when an interrupt is accepted, exception handling begins. in interrupt exception handling, the cpu saves sr and the program counter (pc) to the stack. the priority level of the accepted interrupt is written to bits i3 to i0 in sr. although the priority leve l of the nmi is 16, the value set in bits i3 to i0 is h'f (level 15). next, the start address of the exception handling routine is fetched from the exception handling vector table for the accepted interrupt, and program execution branches to that address and the program starts. for details on the interrupt exception handling, see section 6.6, interrupt operation.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 87 of 1080 rej09b0230-0300 5.5 exceptions triggered by instructions 5.5.1 types of exceptions tri ggered by instructions exception handling can be triggered by the trap instruction, illegal slot instructions, and general illegal instructions, as shown in table 5.9. table 5.9 types of exceptions triggered by instructions type source instruction comment trap instruction trapa ? illegal slot instructions * undefined code placed immediately after a delayed branch instruction (delay slot) or instructions that changes the pc value delayed branch instructions: jmp, jsr, bra, bsr, rts, rte, bf/s, bt/s, bsrf, braf instructions that changes the pc value: jmp, jsr, bra, bsr, rts, rte, bt, bf, trapa, bf/s, bt/s, bsrf, braf, ldc rm,sr, ldc.l @rm+,sr general illegal instructions * undefined code anywhere besides in a delay slot ? note: * the operation is not guaranteed when und efined instructions other than h'f000 to h'ffff are decoded. 5.5.2 trap instructions when a trapa instruction is executed, the trap instruction exception handling starts. the cpu operates as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the start address of the instruction to be executed after the trapa instruction. 3. the cpu reads the start addr ess of the exception handling routine from the exception handling vector table that corresponds to the vector number specified in the trapa instruction, program execution branches to that address, and then the program starts. this branch is not a delayed branch.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 88 of 1080 rej09b0230-0300 5.5.3 illegal slot instructions an instruction placed imme diately after a delayed branch inst ruction is called "instruction placed in a delay slot". when the instruction placed in the delay slot is an undefined code, illegal slot exception handling starts after the undefined code is decoded. illegal slot exception handling also starts when an instruc tion that changes the program counter (p c) value is placed in a delay slot and the instruction is decoded. the cpu handles an illegal slot instruction as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the target address of the delayed branch instruction immediately before the undefined code or the instruction that rewrites the pc. 3. the start address of the exception handling routine is fetched from the exception handling vector table that corresponds to the exception that occurred. program execution branches to that address and the program starts. this branch is not a delayed branch. 5.5.4 general illegal instructions when an undefined code placed anywhere other than immediately after a delayed branch instruction (i.e., in a delay slot) is decoded, general illegal instruction exception handling starts. the cpu handles the general illegal instructions in the same procedures as in the illegal slot instructions. unlike processing of illegal slot instru ctions, however, the program counter value that is stacked is the start address of the undefined code.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 89 of 1080 rej09b0230-0300 5.6 cases when exceptions are accepted when an exception other than rese ts occurs during decoding the inst ruction placed in a delay slot or immediately after an interrupt disabled instruction, it may not be accepted and be held shown in table 5.10. in this case, when an instruction wh ich accepts an interrupt request is decoded, the exception is accepted. table 5.10 delay slot instructions, interrupt disabled instructions, and exceptions exception occurrence timing address error general illegal instruction slot illegal instruction trap instruction interrupt instruction in delay slot * 2 ? * 2 ? * 3 immediately after interrupt disabled instruction * 1 * 4 [legend] : accepted : not accepted ? : does not occur notes: 1. interrupt disabled instructions: ldc, ldc.l, stc, stc.l, lds, lds.l, sts, and sts.l 2. an exception is accepted before the execution of a delayed branch instruction. however, when an address error or a slot illegal instruction exception occurs in the delay slot of the rte instruction, correct operation is not guaranteed. 3. an exception is accepted after a delayed branch (between instructions in the delay slot and the branch destination). 4. an exception is accepted after the execution of the next instruction of an interrupt disabled instruction (before the execution two instructions after an interrupt disabled instruction).
section 5 exception handling rev. 3.00 oct. 06, 2008 page 90 of 1080 rej09b0230-0300 5.7 stack states after exception handling ends the stack states after exception handling ends are shown in table 5.11. table 5.11 stack status after exception handling ends types stack state address error (when the instruction that caused an exception is placed in the delay slot) sp address of delayed branch instruction sr 32 bits 32 bits address error (other than above) sp sr 32 bits 32 bits address of instruction that caused exception interrupt sp sr 32 bits 32 bits address of instruction after executed instruction trap instruction sp sr 32 bits 32 bits address of instruction after trapa instruction
section 5 exception handling rev. 3.00 oct. 06, 2008 page 91 of 1080 rej09b0230-0300 types stack state illegal slot instruction sp address of delayed branch instruction sr 32 bits 32 bits general illegal instruction sp sr 32 bits 32 bits address of g eneral ille g al instruction
section 5 exception handling rev. 3.00 oct. 06, 2008 page 92 of 1080 rej09b0230-0300 5.8 usage notes 5.8.1 value of stack pointer (sp) the sp value must always be a multiple of 4. if it is not, an address error will occur when the stack is accessed during exception handling. 5.8.2 value of vector base register (vbr) the vbr value must always be a multiple of 4. if it is not, an address error will occur when the stack is accessed during exception handling. 5.8.3 address errors caused by stacking for address error exception handling when the sp value is not a multiple of 4, an address error will occur when stacking for exception handling (interrupts, etc.) and address error exception handling will start after the first exception handling is ended. address errors will also occur in the stacking for this address error exception handling. to ensure that address error exception handling does not go into an endless loop, no address errors are accepted at that point. this allows program cont rol to be passed to the handling routine for address error exception and enables error processing. when an address error occurs during exception hand ling stacking, the stacking bus cycle (write) is executed. when stacking the sr and pc values, the sp values for both are subtracted by 4, therefore, the sp value is still not a multiple of 4 after the stacking. the address value output during stacking is the sp value whose lower two bits are cleared to 0. so the write data stacked is undefined.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 93 of 1080 rej09b0230-0300 5.8.4 notes on slot illegal instruction exception handling some specifications on slot illegal instruction exception handling in this lsi differ from those of the conventional sh-2. ? conventional sh-2: instructions ldc rm,sr and ldc.l @rm+,sr are not subject to the slot illegal instructions. ? this lsi: instructions ldc rm,sr and ldc.l @rm+,sr are subject to the slot illegal instructions. the supporting status on our software products regarding this note is as follows: compiler this instruction is not allocated in the delay slot in the compiler v.4 and its subsequent versions. real-time os for itron specifications 1. hi7000/4, hi-sh7 this instruction does not exist in the delay slot within the os. 2. hi7000 this instruction is in part allocated to the delay slot within the os, which may cause the slot illegal instruction exception handling in this lsi. 3. others the slot illegal instruction exception handling may be generated in this lsi in a case where the instruction is described in assembler or when the middleware of the object is introduced. note that a check-up program (checker) to pick up this instruction is available on our website. download and utilize this checker as needed.
section 5 exception handling rev. 3.00 oct. 06, 2008 page 94 of 1080 rej09b0230-0300
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 95 of 1080 rej09b0230-0300 section 6 interrupt controller (intc) the interrupt controller (intc) ascertains the priority of interrupt sources and controls interrupt requests to the cpu. 6.1 features ? 16 levels of interrupt priority ? nmi noise canceler function ? occurrence of interrupt can be reported externally ( irqout pin)
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 96 of 1080 rej09b0230-0300 figure 6.1 shows a block diagram of the intc. irqout nmi irq0 irq1 irq2 irq3 ubc wdt cmt mtu2 a/d sci mtu2s poe rcan-et (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) input control priority determination com- parator interrupt request sr cpu i3 i2 i1 i0 internal bus bus interface ipra, iprd to iprf, iprh to iprm dtcera to dtcere icr0 irqsr irqcr module bus intc ubc: user break controller wdt: watchdo g timer cmt: compare match timer sci: serial communication interface mtu2: multi-function timer pulse unit 2 mtu2s: multi-function timer pulse unit 2s a/d: a/d converter poe: port output enable rcan-et: controller area network dtc: data transfer controller icr0: interrupt control re g ister 0 irqcr: irq control re g ister irqsr: irq status re g ister ipra, iprd to iprf, iprh to iprm: interrupt priority re g isters a, d to f, and h to m sr: status re g ister dtcera to dtcere: dtc enable re g isters a to e ipr [le g end] dtc cpu/dtc request determination cpu/dtc request determination synchronous serial communication unit figure 6.1 block diagram of intc
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 97 of 1080 rej09b0230-0300 6.2 input/output pins table 6.1 shows the intc pin configuration. table 6.1 pin configuration name symbol i/o function non-maskable interrupt input pin nmi input input of non-maskable interrupt request signal interrupt request input pins irq0 to irq3 input input of maskable interrupt request signals interrupt request output pin irqout output output of notification signal when an interrupt has occurred
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 98 of 1080 rej09b0230-0300 6.3 register descriptions the interrupt controller has the following registers. for details on the addresses of these registers and the states of these registers in each proce ssing state, see section 24, list of registers. table 6.2 register configuration register name abbrevia- tion r/w initial value address access size interrupt control register 0 icr0 r/w h'x000 h'ffffe900 8, 16 irq control register irqcr r/w h'0000 h'ffffe902 8, 16 irq status register irqsr r/w h'fx00 h'ffffe904 8, 16 interrupt priority register a ipra r/w h'0000 h'ffffe906 8, 16 interrupt priority register d iprd r/w h'0000 h'ffffe982 16 interrupt priority register e ipre r/w h'0000 h'ffffe984 16 interrupt priority register f iprf r/w h'0000 h'ffffe986 16 interrupt priority register h iprh r/w h'0000 h'ffffe98a 16 interrupt priority register i ipri r/w h'0000 h'ffffe98c 16 interrupt priority register j iprj r/w h'0000 h'ffffe98e 16 interrupt priority register k iprk r/w h'0000 h'ffffe990 16 interrupt priority register l iprl r/w h'0000 h'ffffe992 16 interrupt priority register m iprm r/w h'0000 h'ffffe994 16
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 99 of 1080 rej09b0230-0300 6.3.1 interrupt control register 0 (icr0) icr0 is a 16-bit register that sets the input signal detection mode of the external interrupt input pin nmi and indicates the input signal level on the nmi pin. bit: initial value: r/w: 151413121110987654321 0 note: the initial value is 1 when the level on the nmi pin is hi g h, and 0 when the level on the pin is low. * * 000000000000000 rrrrrrrr/wrrrrrrrr nmil - - - - - - nmie - - - - - - - - bit bit name initial value r/w description 15 nmil * r nmi input level indicates the state of the signal input to the nmi pin. this bit can be read to determine the nmi pin level. this bit cannot be modified. 0: state of the nmi input is low 1: state of the nmi input is high 14 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 8 nmie 0 r/w nmi edge select 0: interrupt request is detected on the falling edge of the nmi input 1: interrupt request is detected on the rising edge of the nmi input 7 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 100 of 1080 rej09b0230-0300 6.3.2 irq control register (irqcr) irqcr is a 16-bit register that sets the input signal detection mode of the external interrupt input pins irq0 to irq3. bit: initial value: r/w: 151413121110987654321 0 00000000 rrrrrrrr 00000000 r/w r/w r/w r/w r/w r/w r/w r/w - - - - - - - - irq31s irq30s irq21s irq20s irq11s irq10s irq01s irq00s bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 6 irq31s irq30s 0 0 r/w r/w irq3 sense select set the interrupt request detection mode for pin irq3. 00: interrupt request is detected at the low level of pin irq3 01: interrupt request is detected at the falling edge of pin irq3 10: interrupt request is detected at the rising edge of pin irq3 11: interrupt request is detected at both the falling and rising edges of pin irq3 5 4 irq21s irq20s 0 0 r/w r/w irq2 sense select set the interrupt request detection mode for pin irq2. 00: interrupt request is detected at the low level of pin irq2 01: interrupt request is detected at the falling edge of pin irq2 10: interrupt request is detected at the rising edge of pin irq2 11: interrupt request is detected at both the falling and rising edges of pin irq2
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 101 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 2 irq11s irq10s 0 0 r/w r/w irq1 sense select set the interrupt request detection mode for pin irq1. 00: interrupt request is detected at the low level of pin irq1 01: interrupt request is detected at the falling edge of pin irq1 10: interrupt request is detected at the rising edge of pin irq1 11: interrupt request is detected at both the falling and rising edges of pin irq1 1 0 irq01s irq00s 0 0 r/w r/w irq0 sense select set the interrupt request detection mode for pin irq0. 00: interrupt request is detected at the low level of pin irq0 01: interrupt request is detected at the falling edge of pin irq0 10: interrupt request is detected at the rising edge of pin irq0 11: interrupt request is detected at both the falling and rising edges of pin irq0 6.3.3 irq status register (irqsr) irqsr is a 16-bit register that indicates the states of the external interrupt input pins irq0 to irq3 and the status of interrupt request. bit: initial value: r/w: 151413121110987654321 0 1111 0000 rrrr rrrr **** 0000 r r r r r/w r/w r/w r/w ---- ---- note: the initial value is 1 when the level on the correspondin g irq pin is hi g h, and 0 when the level on the pin is low. * irq3l irq2l irq1l irq0l irq3f irq2f irq1f irq0f
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 102 of 1080 rej09b0230-0300 bit bit name initial value r/w description 15 to 12 ? all 1 r reserved these bits are always read as 1. the write value should always be 1. 11 irq3l * r indicates the state of pin irq3. 0: state of pin irq3 is low 1: state of pin irq3 is high 10 irq2l * r indicates the state of pin irq2. 0: state of pin irq2 is low 1: state of pin irq2 is high 9 irq1l * r indicates the state of pin irq1. 0: state of pin irq1 is low 1: state of pin irq1 is high 8 irq0l * r indicates the state of pin irq0. 0: state of pin irq0 is low 1: state of pin irq0 is high 7 to 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 irq3f 0 r/w indicates the status of an irq3 interrupt request. ? when level detection mode is selected 0: an irq3 interrupt has not been detected [clearing condition] driving pin irq3 high 1: an irq3 interrupt has been detected [setting condition] driving pin irq3 low ? when edge detection mode is selected 0: an irq3 interrupt has not been detected [clearing conditions] ? writing 0 after reading irq3f = 1 ? accepting an irq3 interrupt 1: an irq3 interrupt request has been detected [setting condition] detecting the specified edge of pin irq3
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 103 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 irq2f 0 r/w indicates the status of an irq2 interrupt request. ? when level detection mode is selected 0: an irq2 interrupt has not been detected [clearing condition] driving pin irq2 high 1: an irq2 interrupt has been detected [setting condition] driving pin irq2 low ? when edge detection mode is selected 0: an irq2 interrupt has not been detected [clearing conditions] ? writing 0 after reading irq2f = 1 ? accepting an irq2 interrupt 1: an irq2 interrupt request has been detected [setting condition] detecting the specified edge of pin irq2 1 irq1f 0 r/w indicates the status of an irq1 interrupt request. ? when level detection mode is selected 0: an irq1 interrupt has not been detected [clearing condition] driving pin irq1 high 1: an irq1 interrupt has been detected [setting condition] driving pin irq1 low ? when edge detection mode is selected 0: an irq1 interrupt has not been detected [clearing conditions] ? writing 0 after reading irq1f = 1 ? accepting an irq1 interrupt 1: an irq1 interrupt request has been detected [setting condition] detecting the specified edge of pin irq1
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 104 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 irq0f 0 r/w indicates the status of an irq0 interrupt request. ? when level detection mode is selected 0: an irq0 interrupt has not been detected [clearing condition] driving pin irq0 high 1: an irq0 interrupt has been detected [setting condition] driving pin irq0 low ? when edge detection mode is selected 0: an irq0 interrupt has not been detected [clearing conditions] ? writing 0 after reading irq0f = 1 ? accepting an irq0 interrupt 1: an irq0 interrupt request has been detected [setting condition] detecting the specified edge of pin irq0 note: * the initial value is 1 when the level on the corresponding irq pin is high, and 0 when the level on the pin is low. 6.3.4 interrupt priority registers a, d to f, and h to m (ipra, iprd to iprf, and iprh to iprm) interrupt priority registers are ten 16-bit readable/writable registers that set priority levels from 0 to 15 for interrupts except nmi. for the correspondence between interrupt request sources and ipr, refer to table 6.3. each of the corresponding interrupt priority ranks are established by setting a value from h'0 to h'f in each of the four-bit groups 15 to 12, 11 to 8, 7 to 4 and 3 to 0. reserved bits that are not assigned should be set h'0 (b'0000). bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ipr[15:12] ipr[11:8] ipr[7:4] ipr[3:0]
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 105 of 1080 rej09b0230-0300 bit bit name initial value r/w description 15 to 12 ipr[15:12] 0000 r/w set priority levels for the corresponding interrupt source. 0000: priority level 0 (lowest) 0001: priority level 1 0010: priority level 2 0011: priority level 3 0100: priority level 4 0101: priority level 5 0110: priority level 6 0111: priority level 7 1000: priority level 8 1001: priority level 9 1010: priority level 10 1011: priority level 11 1100: priority level 12 1101: priority level 13 1110: priority level 14 1111: priority level 15 (highest) 11 to 8 ipr[11:8] 0000 r/w set priority levels for the corresponding interrupt source. 0000: priority level 0 (lowest) 0001: priority level 1 0010: priority level 2 0011: priority level 3 0100: priority level 4 0101: priority level 5 0110: priority level 6 0111: priority level 7 1000: priority level 8 1001: priority level 9 1010: priority level 10 1011: priority level 11 1100: priority level 12 1101: priority level 13 1110: priority level 14 1111: priority level 15 (highest)
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 106 of 1080 rej09b0230-0300 bit bit name initial value r/w description 7 to 4 ipr[7:4] 0000 r/w set priority levels for the corresponding interrupt source. 0000: priority level 0 (lowest) 0001: priority level 1 0010: priority level 2 0011: priority level 3 0100: priority level 4 0101: priority level 5 0110: priority level 6 0111: priority level 7 1000: priority level 8 1001: priority level 9 1010: priority level 10 1011: priority level 11 1100: priority level 12 1101: priority level 13 1110: priority level 14 1111: priority level 15 (highest) 3 to 0 ipr[3:0] 0000 r/w set priority levels for the corresponding interrupt source. 0000: priority level 0 (lowest) 0001: priority level 1 0010: priority level 2 0011: priority level 3 0100: priority level 4 0101: priority level 5 0110: priority level 6 0111: priority level 7 1000: priority level 8 1001: priority level 9 1010: priority level 10 1011: priority level 11 1100: priority level 12 1101: priority level 13 1110: priority level 14 1111: priority level 15 (highest) note: name in the tables above is represented by a general name. name in the list of register is, on the other hand, represented by a module name.
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 107 of 1080 rej09b0230-0300 6.4 interrupt sources 6.4.1 external interrupts there are four types of interrupt sources: user break, nmi, irq, and on-chip peripheral modules. individual interrupts are given priority levels (0 to 16, with 0 the lowest and 16 the highest). giving an interrupt a priority level of 0 masks it. nmi interrupt: the nmi interrupt is given a priority leve l of 16 and is always accepted. an nmi interrupt is detected at the edge of the pins. use the nmi edge select bit (nmie) in interrupt control register 0 (icr0) to select either the rising or falling edge. in the nmi interrupt exception handler, the interrupt mask level bits (i3 to i0) in the status register (sr) are set to level 15. irq3 to irq0 interrupts: irq interrupts are requested by input from pins irq0 to irq3. use the irq sense select bits (irq31s, irq30s to irq01s, and irq00s) in the irq control register (irqcr) to select the detection mode from low level detection, falling edge detection, rising edge detection, and both edge de tection for each pin. the priority level can be set from 0 to 15 for each pin using the interrupt priority register a (ipra). in the case that the low level detection is selected , an interrupt request signal is sent to the intc while the irq pin is driven low. the interrupt request signal stops to be sent to the intc when the irq pin becomes high. it is possible to confirm that an interrupt is requested by reading the irq flags (irq3f to irq0f) in the irq status register (irqsr). in the case that the edge detection is selected, an interrupt request signal is sent to the intc when the following change on the irq pin is detected: from high to low in falling edge detection mode, from low to high in rising edge detection mode, and from low to high or from high to low in both edge detection mode. the irq interrupt request by detecting the change on the pin is held until the interrupt request is accepted. it is possible to confirm that an irq interrupt request has been detected by reading the irq flags (irq3f to irq0f) in the irq status register (irqsr). an irq interrupt request by detecting the change on the pin can be withdrawn by writing 0 to an irq flag after reading 1. in the irq interrupt exception handling, the interrupt mask bits (i3 to i0) in the status register (sr) are set to the prio rity level value of the accepted irq interrupt. figure 6.2 shows the block diagram of the irq3 to irq0 interrupts.
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 108 of 1080 rej09b0230-0300 irqcr.irqn1s irqcr.irqn0s irqsr.irqnf irqsr.irqnl irqn pins resirqn level detection ed g e detection sq r selection dtc activation request cpu interrupt request (acceptance of irqn interrupt/ writin g 0 after readin g irqnf = 1) n = 3 to 0 distribution figure 6.2 block diagram of irq3 to irq0 interrupts control 6.4.2 on-chip peripheral module interrupts on-chip peripheral module interrupts are interrupt s generated by the following on-chip peripheral modules. since a different interrupt vector is allocated to each interrupt source, the exception handling routine does not have to decide which interrupt has occurred. priority levels between 0 and 15 can be allocated to individual on-chip peripheral modules in interrupt priority registers d to f and h to m (iprd to iprf and iprh to iprm). on-chip peripheral module interrupt exception handling sets the interrupt mask level bits (i3 to i0) in the status register (sr) to the priority level value of the on-chip peripheral module interrupt that was accepted. 6.4.3 user break interrupt a user break interrupt has a priority level of 15, and occurs when the break condition set in the user break controller (ubc) is satisfied. user break interrupt requests are detected by edge and are held until accepted. user break interrupt exception handling sets the interrupt mask level bits (i3 to i0) in the status register (sr) to level 15. for more details on the user break interrupt, see section 7, user break controller (ubc).
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 109 of 1080 rej09b0230-0300 6.5 interrupt exception handling vector table table 6.3 lists interrupt sources, their vector numbers, vector table address offsets, and interrupt priorities. individual interrupt sources are allocated to di fferent vector numbers and vector table address offsets. vector table addresses are calculated fr om the vector numbers and vector table address offsets. for interrupt exception handling, the start address of the exception handling routine is fetched from the vector table address in the vector table. for the details on calculation of vector table addresses, see table 5.4. irq interrupts and on-chip peripheral module interrupt priorities can be set freely between 0 and 15 for each pin or module by setting interrupt priority registers a, d to f and h to m (ipra, iprd to iprf, and iprh to iprm). however, when interrupt sources whose priority levels are allocated with the same ipr are re quested, the interrupt of the smaller vector number has priority. this priority cannot be changed. priority levels of irq interrupts and on-chip peripheral module interrupts are initialized to level 0 at a power-on reset. if the same priority level is allocated to two or more interrupt sources and interrupts from those sources occur simultaneously, they are processed by the default priority order shown in table 6.3. table 6.3 interrupt exception ha ndling vectors and priorities interrupt source name vector no. vector table starting address ipr default priority user break 12 h'00000030 ? high external pin nmi 11 h'0000002c ? irq0 64 h'00000100 ipra15 to ipra12 irq1 65 h'00000104 ipra11 to ipra8 irq2 66 h'00000108 ipra7 to ipra4 irq3 67 h'0000010c ipra3 to ipra0 tgia_0 88 h'00000160 iprd15 to iprd12 tgib_0 89 h'00000164 tgic_0 90 h'00000168 tgid_0 91 h'0000016c tciv_0 92 h'00000170 iprd11 to iprd8 mtu2_0 tgie_0 93 h'00000174 tgif_0 94 h'00000178 low
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 110 of 1080 rej09b0230-0300 interrupt source name vector no. vector table starting address ipr default priority tgia_1 96 h'00000180 iprd7 to iprd4 high tgib_1 97 h'00000184 tciv_1 100 h'00000190 iprd3 to iprd0 mtu2_1 tciu_1 101 h'00000194 mtu2_2 tgia_2 104 h'000001a0 ipre15 to ipre12 tgib_2 105 h'000001a4 tciv_2 108 h'000001b0 ipre11 to ipre8 tciu_2 109 h'000001b4 mtu2_3 tgia_3 112 h'000001c0 ipre7 to ipre4 tgib_3 113 h'000001c4 tgic_3 114 h'000001c8 tgid_3 115 h'000001cc tciv_3 116 h'000001d0 ipre3 to ipre0 mtu2_4 tgia_4 120 h'000001e0 iprf15 to iprf12 tgib_4 121 h'000001e4 tgic_4 122 h'000001e8 tgid_4 123 h'000001ec tciv_4 124 h'000001f0 iprf11 to iprf8 poe (mtu2) oei1 132 h'00000210 iprf3 to iprf0 oei3 133 h'00000214 tgia_3s 160 h'00000280 iprh7 to iprh4 tgib_3s 161 h'00000284 tgic_3s 162 h'00000288 tgid_3s 163 h'0000028c mtu2s_3 tciv_3s 164 h'00000290 iprh3 to iprh0 tgia_4s 168 h'000002a0 ipri15 to ipri12 tgib_4s 169 h'000002a4 tgic_4s 170 h'000002a8 mtu2s_4 tgid_4s 171 h'000002ac tciv_4s 172 h'000002b0 ipri11 to ipri8 low
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 111 of 1080 rej09b0230-0300 interrupt source name vector no. vector table starting address ipr default priority mtu2s_5 tgiu_5s 176 h'000002c0 ipri7 to ipri4 high tgiv_5s 177 h'000002c4 tgiw_5s 178 h'000002c8 poe (mtu2s) oei2 180 h'000002d0 ipri3 to ipri0 cmt_0 cmi_0 184 h'000002e0 iprj15 to iprj12 cmt_1 cmi_1 188 h'000002f0 iprj11 to iprj8 wdt iti 196 h'00000310 iprj3 to iprj0 a/d_0 adi_3 208 h'00000340 iprk7 to iprk4 a/d_1 adi_4 212 h'00000350 iprk3 to iprk0 sci_0 eri_0 216 h'00000360 iprl15 to iprl12 rxi_0 217 h'00000364 txi_0 218 h'00000368 tei_0 219 h'0000036c sci_1 eri_1 220 h'00000370 iprl11 to iprl8 rxi_1 221 h'00000374 txi_1 222 h'00000378 tei_1 223 h'0000037c sci_2 eri_2 224 h'00000380 iprl7 to iprl4 rxi_2 225 h'00000384 txi_2 226 h'00000388 tei_2 227 h'0000038c sseri 232 h'000003a0 iprm15 to iprm12 ssrxi 233 h'000003a4 synchronous serial communication unit sstxi 234 h'000003a8 low
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 112 of 1080 rej09b0230-0300 interrupt source name vector no. vector table starting address ipr default priority ers_0 240 h'000003c0 iprm7 to iprm4 high ovr_0 241 h'000003c4 rm0_0 242 h'000003c8 rm1_0 rcan-et_0 sle_0 243 h'000003cc rcan-et_1 * ers_1 244 h'000003d0 iprm3 to iprm0 ovr_1 245 h'000003d4 rm0_1 246 h'000003d8 rm1_1 sle_1 247 h'000003dc low note: * available only in the sh7142.
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 113 of 1080 rej09b0230-0300 6.6 interrupt operation 6.6.1 interrupt sequence the sequence of interrupt operations is explained below. figure 6.3 is a flowchart of the operations. 1. the interrupt request sources send interrupt request signals to the interrupt controller. 2. the interrupt controller selects the highest priority interrupt from interrupt requests sent, according to the prior ity levels set in interrupt priority registers a, d to f, and h to m (ipra, iprd to iprf, and iprh to iprm). interrupts that have lower-priority than that of the selected interrupt are ignored * . if interrupts that have the same priority level or interrupts within a same module occur simultaneously, the interrupt with the highest priority is selected according to the default priority shown in table 6.3. 3. the interrupt controller compares the priority level of the selected interrupt request with the interrupt mask bits (i3 to i0) in the status register (sr) of the cpu. if the priority level of the selected request is equal to or less than the level set in bits i3 to i0, the request is ignored. if the priority level of the selected request is higher than the level in bits i3 to i0, the interrupt controller accepts the request and sends an interrupt request signal to the cpu. 4. when the interrupt controller accepts an interrupt, a low level is output from the irqout pin. 5. the cpu detects the interrupt request sent from the interrupt controller in the decode stage of an instruction to be executed . instead of executing the decode d instruction, the cpu starts interrupt exception handling. 6. sr and pc are saved onto the stack. 7. the priority level of the accepted interrupt is copied to bits (i3 to i0) in sr. 8. when the accepted interrupt is sensed by level or is from an on-chip peripheral module, a high level is output from the irqout pin. when the accepted interrupt is sensed by edge, a high level is output from the irqout pin at the moment when the cpu starts interrupt exception processing instead of instruction execution as noted in 5. above. however, if the interrupt controller accepts an interrupt with a higher priority th an the interrupt just to be accepted, the irqout pin holds low level. 9. the cpu reads the start addr ess of the exception handling rou tine from the exception vector table for the accepted interrupt, branches to that address, a nd starts executing the program. this branch is not a delayed branch.
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 114 of 1080 rej09b0230-0300 notes: the interrupt source flag should be cleared in the interrupt handler. to ensure that an interrupt source that should have been clear ed is not inadvertently accepted again, read the interrupt source flag after it has been cleared, confirm that it has been cleared, and then execute an rte instruction. * interrupt requests that are designated as edge-detect type are held pending until the interrupt requests are accepted. irq interrupts, however, can be cancelled by accessing the irq status register (irqsr). interrupts held pending due to edge detection are cleared by a power-on reset or a manual reset.
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 115 of 1080 rej09b0230-0300 pro g ram execution state interrupt? user break? i3 to i0 level 14? level 14 interrupt? level 1 interrupt? i3 to i0 level 13? i3 to i0 = level 0? no yes no no no no no no no yes yes yes yes yes yes yes save sr to stack irqout = low save pc to stack copy interrupt level to i3 to i0 read exception vector table branch to exception handlin g routine no yes level 15 interrupt? notes: i3 to i0 are interrupt mask bits in the status re g ister (sr) of the cpu 1. irqout is the same si g nal as the interrupt request si g nal to the cpu (see fi g ure 6.1). therefore, irqout is output when the request priority level is hi g her than the level in bits i3?i0 of sr. 2. when the accepted interrupt is sensed by ed g e, a hi g h level is output from the irqout pin at the moment when the cpu starts interrupt exception processin g instead of instruction execution (namely, before savin g sr to stack). however, if the interrupt controller accepts an interrupt with a hi g her priority than the interrupt just to be accepted and has output an interrupt request to the cpu, the irqout pin holds low level. 3. the irqout pin chan g e timin g depends on a frequency dividin g ratio between the internal (i ) and bus (b ) clocks. this flowchart shows that the frequency dividin g ratios of the internal (i ) and bus (b ) clocks are the same. nmi? i3 to i0 level 14? no yes irqout = hi g h * 1 * 3 * 2 * 3 figure 6.3 interrupt sequence flowchart
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 116 of 1080 rej09b0230-0300 6.6.2 stack after interrupt exception handling figure 6.4 shows the stack after interrupt exception handling. 32 bits 32 bits pc * 1 sr address 4n ? 8 4n ? 4 4n sp * 2 notes: 1. pc is the start address of the next instruction (instruction at the return address) after the executed instruction. 2. always make sure that sp is a multiple of 4 figure 6.4 stack after interrupt exception handling 6.7 interrupt resp onse time table 6.4 lists the interrupt response time, which is the time from the occurrence of an interrupt request until the interrupt exception handling starts and fetching of the first instruction of the interrupt handling routine begins.
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 117 of 1080 rej09b0230-0300 table 6.4 interrupt response time number of cycles item nmi irq peripheral modules remarks dtc active judgment ? 2 bcyc 1 pcyc interrupt priority decision and comparison with mask bits in sr 1 icyc + 2 pcyc 1 icyc + 1 pcyc 1 icyc + 2 pcyc wait for completion of sequence currently being executed by cpu x ( 0) x ( 0) x ( 0) the longest sequence is for interrupt or address- error exception handling (x = 7 icyc + m1 + m2 + m3 + m4). if an interrupt-masking instruction follows, however, the time may be even longer. time from start of interrupt exception handling until fetch of first instruction of exception handling routine starts 8 icyc + m1 + m2 + m3 8 icyc + m1 + m2 + m3 8 icyc + m1 + m2 + m3 performs the saving pc and sr, and vector address fetch. interrupt response time total: 9 icyc + 2 pcyc + m1 + m2 + m3 + x 9 icyc + 1 pcyc + 2 bcyc + m1 + m2 + m3 + x 9 icyc + 3 pcyc + m1 + m2 + m3 + x minimum * : 12 icyc + 2 pcyc 12 icyc + 1 pcyc + 2 bcyc 12 icyc + 3 pcyc sr, pc, and vector table are all in on-chip ram. maximum: 16 icyc + 2 pcyc + 2 (m1 + m2 + m3) + m4 16 icyc + 1 pcyc + 2 bcyc + 2 (m1 + m2 + m3) + m4 16 icyc + 3 pcyc + 2 (m1 + m2 + m3) + m4 notes: * in the case that m1 = m2 = m3 = m4 = 1 icyc. m1 to m4 are the number of cycles needed for the following memory accesses. m1: sr save (longword write) m2: pc save (longword write) m3: vector address read (longword read) m4: fetch first instruction of interrupt service routine
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 118 of 1080 rej09b0230-0300 6.8 data transfer with int errupt request signals the following data transfers can be done using interrupt request signals: ? activate dtc only; cpu interrupts depend on dtc settings the intc masks a cpu interrupt when the corr esponding dtce bit is 1. the conditions for clearing dtce and interrupt source flag are shown below. dtce clear condition = dtc transfer end ? dtceclr interrupt source flag clear condition = dtc transfer end ? dtceclr where dtceclr = disel + counter 0 figures 6.5 and 6.6 show control block diagrams. irq fla g clear by dtc interrupt request to cpu dtc activation request dtceclr transfer end dtcer dtce clear interrupt priority determination interrupt controller irq detection irq ed g e detector (in standby mode) irq pin dtc standby cancel determination standby control figure 6.5 irq interrupt control block diagram
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 119 of 1080 rej09b0230-0300 dtc activation request dtceclr transfer end interrupt request to cpu interrupt priority determination interrupt controller interrupt source fla g clear by dtc dtce clear interrupt source fla g clear interrupt source dtcer dtc figure 6.6 on-chip module interrupt control block diagram 6.8.1 handling interrupt request signals as sources for dtc activation and cpu interrupts 1. for dtc, set the corresponding dtce bits and disel bits to 1. 2. when an interrupt occurs, an activation request is sent to the dtc. 3. when completing a data transfer, the dtc cl ears the dtce bit to 0 and sends an interrupt request to the cpu. the activation source is not cleared. 4. the cpu clears the interrupt s ource in the interrupt handling routine then checks the transfer counter value. when the transfer counter value is not 0, the cpu sets the dtce bit to 1 and allows the next data transfer. if the transfer counter value = 0, the cpu performs the necessary end processing in the interrupt processing routine. 6.8.2 handling interrupt request signals as so urces for dtc activation, but not cpu interrupts 1. for dtc, set the corresponding dtce bits to 1 and clear the disel bits to 0. 2. when an interrupt occurs, an activation request is sent to the dtc. 3. when completing a data transf er, the dtc clears the activation s ource. no interrupt request is sent to the cpu because the dtce bit is held at 1. 4. however, when the transfer counter value = 0, the dtce bit is cleared to 0 and an interrupt request is sent to the cpu. 5. the cpu performs the necessary end processing in the interrupt handling routine.
section 6 interrupt controller (intc) rev. 3.00 oct. 06, 2008 page 120 of 1080 rej09b0230-0300 6.8.3 handling interrupt request signals as so urces for cpu interrupts, but not dtc activation 1. for dtc, clear the corresponding dtce bits to 0. 2. when an interrupt occurs, an interrupt request is sent to the cpu. 3. the cpu clears the interrupt source and performs the necessary processing in the interrupt handling routine. 6.9 usage note the interrupt source flag should be cleared in the interrupt handler. to ensure that an interrupt source that should have been cleared is not inadvertently accepted again, read the interrupt source flag after it has been cleared, confirm that it has been cleared, and then execute an rte instruction.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 121 of 1080 rej09b0230-0300 section 7 user br eak controller (ubc) the user break controller (ubc) provides functions that simplify program debugging. these functions make it easy to design an effective self-monitoring debugger, enabling the chip to debug programs without using an in-circuit emulator. break conditions that can be set in the ubc are instruction fetch or data read/write access, data si ze, data contents, address value, and stop timing in the case of instruction fetch. 7.1 features the ubc has the following features: 1. the following break comparison conditions can be set. number of break channels: two channels (channels a and b) user break can be requested as either the independent or sequential condition on channels a and b (sequential break setting: channel a and then channel b match with break conditions, but not in the same bus cycle). ? address comparison bits are maskable in 1-bit units. one of the two address buses (l-bus address (l ab) and i-bus address (iab)) can be selected. ? data 32-bit maskable. one of the two data buses (l-bus data (l db) and i-bus data (idb)) can be selected. ? bus cycle instruction fetch or data access ? read/write ? operand size byte, word, and longword 2. a user-designed user-break interrupt exception processing routine can be run. 3. in an instruction fetch cycle, whether a user break is set before or after execution of an instruction can be selected. 4. maximum repeat times for the break condition (only for channel b): 2 12 ? 1 times. 5. two pairs of branch source/destination buffers.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 122 of 1080 rej09b0230-0300 figure 7.1 shows a block diagram of the ubc. bbra bara bamra cpu state si g nals ldb iab idb lab internal bus access comparator address comparator channel a access comparator address comparator data comparator pc trace control channel b bbrb betr bdra bdmra barb bamrb bdrb bdmrb brsr brdr brcr user break interrupt request [le g end] bbra: break bus cycle re g ister a bara: break address re g ister a bamra: break address mask re g ister a bdra: break data re g ister a bdmra: break data mask re g ister a bbrb: break bus cycle re g ister b barb: break address re g ister b bamrb: break address mask re g ister b bdrb: break data re g ister b bdmrb: break data mask re g ister b betr: execution times break re g ister brsr: branch source re g ister brdr: branch destination re g ister brcr: break control re g ister access control data comparator figure 7.1 block diagram of ubc
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 123 of 1080 rej09b0230-0300 7.2 input/output pins table 7.1 shows the ubc pin configuration. table 7.1 pin configuration pin name symbol i/o function user break trigger output ubctrg output ubc condition match trigger output pin.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 124 of 1080 rej09b0230-0300 7.3 register descriptions the user break controller has the following registers. for details on register addresses and register states during each processing, refer to section 24, list of registers. table 7.2 register configuration register name abbrevia- tion r/w initial value address access size break address register a bara r/w h'00000000 h'fffff300 32 break address mask register a bamra r/w h'00000000 h'fffff304 32 break bus cycle register a bbra r/w h'0000 h'fffff308 16 break data register a bdra r/w h'00000000 h'fffff310 32 break data mask register a bdmra r/w h'00000000 h'fffff314 32 break address register b barb r/w h'00000000 h'fffff320 32 break address mask register b bamrb r/w h'00000000 h'fffff324 32 break bus cycle register b bbrb r/w h'0000 h'fffff328 16 break data register b bdrb r/w h'00000000 h'fffff330 32 break data mask register b bdmrb r/w h'00000000 h'fffff334 32 break control register brcr r/w h'00000000 h'fffff3c0 32 branch source register brsr r h'0xxxxxxx h'fffff3d0 32 branch destination register brdr r h'0xxxxxxx h'fffff3d4 32 execution times break register betr r/w h'0000 h'fffff3dc 16
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 125 of 1080 rej09b0230-0300 7.3.1 break address register a (bara) bara is a 32-bit readable/writable register. bara specifies the address used as a break condition in channel a. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w baa31 baa30 baa29 baa28 baa27 baa26 baa25 baa24 baa23 baa22 baa21 baa20 baa19 baa18 baa17 baa16 baa15 baa14 baa13 baa12 baa11 baa10 baa9 baa8 baa7 baa6 baa5 baa4 baa3 baa2 baa1 baa0 bit bit name initial value r/w description 31 to 0 baa31 to baa0 all 0 r/w break address a store the address on the lab or iab specifying break conditions of channel a. 7.3.2 break address mask register a (bamra) bamra is a 32-bit readable/writable register. bamra specifies bits masked in the break address specified by bara. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bama31 bama30 bama29 bama28 bama27 bama26 bama25 bama24 bama23 bama22 bama21 bama20 bama19 bama18 bama17 bama16 bama15 bama14 bama13 bama12 bama11 bama10 bama9 bama8 bama7 bama6 bama5 bama4 bama3 bama2 bama1 bama0
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 126 of 1080 rej09b0230-0300 bit bit name initial value r/w description 31 to 0 bama31 to bama0 all 0 r/w break address mask a specify bits masked in the channel a break address bits specified by bara (baa31 to baa0). 0: break address bit baan of channel a is included in the break condition 1: break address bit baan of channel a is masked and is not included in the break condition note: n = 31 to 0 7.3.3 break bus cycle register a (bbra) bbra is a 16-bit readable/writable register, which specifies (1) bus master for i bus cycle, (2) l bus cycle or i bus cycle, (3) instruction fetch or data access, (4) read or write, and (5) operand size in the break conditions of channel a. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/w - - - - - cpa[2:0] cda[1:0] ida[1:0] rwa[1:0] sza[1:0] bit bit name initial value r/w description 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10 to 8 cpa[2:0] 000 r/w bus master select a for i bus select the bus master when the i bus is selected as the bus cycle of the channel a break condition. however, when the l bus is selected as the bus cycle, the setting of the cpa2 to cpa0 bits is disabled. 000: condition comparison is not performed xx1: the cpu cycle is included in the break condition x1x: setting prohibited 1xx: the dtc cycle is included in the break condition
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 127 of 1080 rej09b0230-0300 bit bit name initial value r/w description 7, 6 cda[1:0] 00 r/w l bus cycle/i bus cycle select a select the l bus cycle or i bus cycle as the bus cycle of the channel a break condition. 00: condition comparison is not performed 01: the break condition is the l bus cycle 10: the break condition is the i bus cycle 11: the break condition is the l bus cycle 5, 4 ida[1:0] 00 r/w instruction fetch/data access select a select the instruction fetch cycle or data access cycle as the bus cycle of the channel a break condition. 00: condition comparison is not performed 01: the break condition is the instruction fetch cycle 10: the break condition is the data access cycle 11: the break condition is the instruction fetch cycle or data access cycle 3, 2 rwa[1:0] 00 r/w read/write select a select the read cycle or write cycle as the bus cycle of the channel a break condition. 00: condition comparison is not performed 01: the break condition is the read cycle 10: the break condition is the write cycle 11: the break condition is the read cycle or write cycle 1, 0 sza[1:0] 00 r/w operand size select a select the operand size of the bus cycle for the channel a break condition. 00: the break condition does not include operand size 01: the break condition is byte access 10: the break condition is word access 11: the break condition is longword access note: when specifying the operand size, specify the size which matches the address boundary. [legend] x: don't care.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 128 of 1080 rej09b0230-0300 7.3.4 break data register a (bdra) bdra is a 32-bit readable/writabl e register. the control bits c da1 and cda0 in bbra select one of two data buses for break condition a. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bda31 bda30 bda29 bda28 bda27 bda26 bda25 bda24 bda23 bda22 bda21 bda20 bda19 bda18 bda17 bda16 bda15 bda14 bda13 bda12 bda11 bda10 bda9 bda8 bda7 bda6 bda5 bda4 bda3 bda2 bda1 bda0 bit bit name initial value r/w description 31 to 0 bda31 to bda0 all 0 r/w break data bit a stores data which specifies a break condition in channel a. if the i bus is selected in bbra, the break data on idb is set in bda31 to bda0. if the l bus is selected in bbra, the break data on ldb is set in bda31 to bda0. notes: 1. specify an operand size when including the value of the data bus in the break condition. 2. when the byte size is selected as a break condition, the same byte data must be set in bits 15 to 8 and 7 to 0 in bdra as the break data.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 129 of 1080 rej09b0230-0300 7.3.5 break data mask register a (bdmra) bdmra is a 32-bit readable/writable register. bdmra specifies bits masked in the break data specified by bdra. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bdma31 bdma30 bdma29 bdma28 bdma27 bdma26 bdma25 bdma24 bdma23 bdma22 bdma21 bdma20 bdma19 bdma18 bdma17 bdma16 bdma15 bdma14 bdma13 bdma12 bdma11 bdma10 bdma9 bdma8 bdma7 bdma6 bdma5 bdma4 bdma3 bdma2 bdma1 bdma0 bit bit name initial value r/w description 31 to 0 bdma31 to bdma0 all 0 r/w break data mask a specifies bits masked in the break data of channel a specified by bdra (bda31 to bda0). 0: break data bdan of channel a is included in the break condition 1: break data bdan of channel a is masked and is not included in the break condition note: n = 31 to 0 notes: 1. specify an operand size when including the value of the data bus in the break condition. 2. when the byte size is selected as a break condition, the same byte data must be set in bits 15 to 8 and 7 to 0 in bdmra as the break mask data in bdra.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 130 of 1080 rej09b0230-0300 7.3.6 break address register b (barb) barb is a 32-bit readable/writable register. barb specifies the address used as a break condition in channel b. control bits cdb1 and cdb0 in bbrb select one of the two address buses for break condition b. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bab31 bab30 bab29 bab28 bab27 bab26 bab25 bab24 bab23 bab22 bab21 bab20 bab19 bab18 bab17 bab16 bab15 bab14 bab13 bab12 bab11 bab10 bab9 bab8 bab7 bab6 bab5 bab4 bab3 bab2 bab1 bab0 bit bit name initial value r/w description 31 to 0 bab31 to bab0 all 0 r/w break address b stores an address which specifies a break condition in channel b. if the i bus or l bus is selected in bbrb, an iab or lab address is set in bab31 to bab0.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 131 of 1080 rej09b0230-0300 7.3.7 break address mask register b (bamrb) bamrb is a 32-bit readable/writable register. bamr b specifies bits masked in the break address specified by barb. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bamb31 bamb30 bamb29 bamb28 bamb27 bamb26 bamb25 bamb24 bamb23 bamb22 bamb21 bamb20 bamb19 bamb18 bamb17 bamb16 bamb15 bamb14 bamb13 bamb12 bamb11 bamb10 bamb9 bamb8 bamb7 bamb6 bamb5 bamb4 bamb3 bamb2 bamb1 bamb0 bit bit name initial value r/w description 31 to 0 bamb31 to bamb0 all 0 r/w break address mask b specifies bits masked in the break address of channel b specified by barb (bab31 to bab0). 0: break address babn of channel b is included in the break condition 1: break address babn of channel b is masked and is not included in the break condition note: n = 31 to 0
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 132 of 1080 rej09b0230-0300 7.3.8 break data register b (bdrb) bdrb is a 32-bit readable/writable register. the control bits cdb1 and cdb0 in bbrb select one of the two data buses for break condition b. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bdb31 bdb30 bdb29 bdb28 bdb27 bdb26 bdb25 bdb24 bdb23 bdb22 bdb21 bdb20 bdb19 bdb18 bdb17 bdb16 bdb15 bdb14 bdb13 bdb12 bdb11 bdb10 bdb9 bdb8 bdb7 bdb6 bdb5 bdb4 bdb3 bdb2 bdb1 bdb0 bit bit name initial value r/w description 31 to 0 bdb31 to bdb0 all 0 r/w break data bit b stores data which specifies a break condition in channel b. if the i bus is selected in bbrb, the break data on idb is set in bdb31 to bdb0. if the l bus is selected in bbrb, the break data on ldb is set in bdb31 to bdb0. notes: 1. specify an operand size when including the value of the data bus in the break condition. 2. when the byte size is selected as a break condition, the same byte data must be set in bits 15 to 8 and 7 to 0 in bdrb as the break data.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 133 of 1080 rej09b0230-0300 7.3.9 break data mask register b (bdmrb) bdmrb is a 32-bit readable/writable register. bd mrb specifies bits masked in the break data specified by bdrb. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bdmb31 bdmb30 bdmb29 bdmb28 bdmb27 bdmb26 bdmb25 bdmb24 bdmb23 bdmb22 bdmb21 bdmb20 bdmb19 bdmb18 bdmb17 bdmb16 bdmb15 bdmb14 bdmb13 bdmb12 bdmb11 bdmb10 bdmb9 bdmb8 bdmb7 bdmb6 bdmb5 bdmb4 bdmb3 bdmb2 bdmb1 bdmb0 bit bit name initial value r/w description 31 to 0 bdmb31 to bdmb0 all 0 r/w break data mask b specifies bits masked in the break data of channel b specified by bdrb (bdb31 to bdb0). 0: break data bdbn of channel b is included in the break condition 1: break data bdbn of channel b is masked and is not included in the break condition note: n = 31 to 0 notes: 1. specify an operand size when including the value of the data bus in the break condition. 2. when the byte size is selected as a break condition, the same byte data must be set in bits 15 to 8 and 7 to 0 in bdmrb as the break mask data in bdrb.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 134 of 1080 rej09b0230-0300 7.3.10 break bus cycle register b (bbrb) bbrb is a 16-bit readable/writable register, which specifies (1) bus master for i bus cycle, (2) l bus cycle or i bus cycle, (3) instruction fetch or data access, (4) read or write, and (5) operand size in the break conditions of channel b. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/w - - - - - cpb[2:0] idb[1:0] cdb[1:0] rwb[1:0] szb[1:0] bit bit name initial value r/w description 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10 to 8 cpb[2:0] 000 r/w bus master select b for i bus select the bus master when the i bus is selected as the bus cycle of the channel b break condition. however, when the l bus is selected as the bus cycle, the setting of the cpb2 to cpb0 bits is disabled. 000: condition comparison is not performed xx1: the cpu cycle is included in the break condition x1x: setting prohibited 1xx: the dtc cycle is included in the break condition 7, 6 cdb[1:0] 00 r/w l bus cycle/i bus cycle select b select the l bus cycle or i bus cycle as the bus cycle of the channel b break condition. 00: condition comparison is not performed 01: the break condition is the l bus cycle 10: the break condition is the i bus cycle 11: the break condition is the l bus cycle
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 135 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5, 4 idb[1:0] 00 r/w instruction fetch/data access select b select the instruction fetch cycle or data access cycle as the bus cycle of the channel b break condition. 00: condition comparison is not performed 01: the break condition is the instruction fetch cycle 10: the break condition is the data access cycle 11: the break condition is the instruction fetch cycle or data access cycle 3, 2 rwb[1:0] 00 r/w read/write select b select the read cycle or write cycle as the bus cycle of the channel b break condition. 00: condition comparison is not performed 01: the break condition is the read cycle 10: the break condition is the write cycle 11: the break condition is the read cycle or write cycle 1, 0 szb[1:0] 00 r/w operand size select b select the operand size of the bus cycle for the channel b break condition. 00: the break condition does not include operand size 01: the break condition is byte access 10: the break condition is word access 11: the break condition is longword access note: when specifying the operand size, specify the size which matches the address boundary. [legend] x: don't care.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 136 of 1080 rej09b0230-0300 7.3.11 break control register (brcr) brcr sets the following conditions: 1. specifies whether channels a and b conditions are used as two independent conditions or as the sequential condition. 2. specifies whether a user break is se t before or after instruction execution. 3. specifies whether to include the number of execution times in channel b comparison conditions. 4. specifies whether to include data bus in channels a and b comparison conditions. 5. enables pc trace. 6. selects the pulse width of the ubctrg output. 7. specifies whether to request a user break in terrupt on a match of channels a and b comparison conditions. brcr is a 32-bit readable/writable register that has break conditions match flags and bits for setting a variety of break conditions. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 rrrrrrrrrrr/wr/wr/wrr/wr 0000000000000000 r/w r/w r/w r/w r/w r/w r r r/w r/w r/w r r/w r r r/w ----------ut rgw[1:0] ubidb - ubida - scm fca scm fcb scm fda scm fdb pcte pcba - - dbea pcbb dbeb - seq - - etbe
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 137 of 1080 rej09b0230-0300 bit bit name initial value r/w description 31 to 22 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 21, 20 utrgw[1:0] 00 r/w ubctrg output pulse width select select the ubctrg output pulse width when the break condition matches. 00: setting prohibited 01: ubctrg output pulse width is 3 to 4 t bcyc 10: ubctrg output pulse width is 7 to 8 t bcyc 11: ubctrg output pulse width is 15 to 16 t bcyc note: t bcyc indicates the period of one cycle of the external bus clock (b = ck). 19 ubidb 0 r/w user break disable b enables or disables the user break interrupt request when the channel b break conditions are satisfied. 0: user break interrupt request is enabled when break conditions are satisfied 1: user break interrupt request is disabled when break conditions are satisfied 18 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 17 ubida 0 r/w user break disable a enables or disables the user break interrupt request when the channel a break conditions are satisfied. 0: user break interrupt request is enabled when break conditions are satisfied 1: user break interrupt request is disabled when break conditions are satisfied 16 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 138 of 1080 rej09b0230-0300 bit bit name initial value r/w description 15 scmfca 0 r/w l bus cycle condition match flag a when the l bus cycle condition in the break conditions set for channel a is satisfied, this flag is set to 1. in order to clear this flag, write 0 into this bit. 0: the l bus cycle condition for channel a does not match 1: the l bus cycle condition for channel a matches 14 scmfcb 0 r/w l bus cycle condition match flag b when the l bus cycle condition in the break conditions set for channel b is satisfied, this flag is set to 1. in order to clear this flag, write 0 into this bit. 0: the l bus cycle condition for channel b does not match 1: the l bus cycle condition for channel b matches 13 scmfda 0 r/w i bus cycle condition match flag a when the i bus cycle condition in the break conditions set for channel a is satisfied, this flag is set to 1. in order to clear this flag, write 0 into this bit. 0: the i bus cycle condition for channel a does not match 1: the i bus cycle condition for channel a matches 12 scmfdb 0 r/w i bus cycle condition match flag b when the i bus cycle condition in the break conditions set for channel b is satisfied, this flag is set to 1. in order to clear this flag, write 0 into this bit. 0: the i bus cycle condition for channel b does not match 1: the i bus cycle condition for channel b matches 11 pcte 0 r/w pc trace enable 0: disables pc trace 1: enables pc trace
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 139 of 1080 rej09b0230-0300 bit bit name initial value r/w description 10 pcba 0 r/w pc break select a selects the break timing of the instruction fetch cycle for channel a as before or after instruction execution. 0: pc break of channel a is set before instruction execution 1: pc break of channel a is set after instruction execution 9, 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 dbea 0 r/w data break enable a selects whether or not the data bus value is included in the channel a break condition. 0: the data bus value is not included in the channel a break condition 1: the data bus value is included in the channel a break condition 6 pcbb 0 r/w pc break select b selects the break timing of the instruction fetch cycle for channel b as before or after instruction execution. 0: pc break of channel b is set before instruction execution 1: pc break of channel b is set after instruction execution 5 dbeb 0 r/w data break enable b selects whether or not the data bus value is included in the channel b break condition. 0: the data bus value is not included in the channel b break condition 1: the data bus value is included in the channel b break condition 4 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 140 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 seq 0 r/w sequence condition select selects two conditions of channels a and b as independent or sequential conditions. 0: channels a and b are compared under independent conditions 1: channels a and b are compared under sequential conditions (channel a, then channel b) 2, 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 etbe 0 r/w number of execution times break enable enables the execution-times break condition only on channel b. if this bit is 1 (break enable), a user break is issued when the number of break conditions matches with the number of execution times that is specified by betr. 0: the execution-times break condition is disabled on channel b 1: the execution-times break condition is enabled on channel b note: the operand size must be specified if the data bus value is included in the break condition and the interrupt cycle is specified in the break condition with the rwa and/or rwb bits.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 141 of 1080 rej09b0230-0300 7.3.12 execution times break register (betr) betr is a 16-bit readable/writable register. when the execution-times break condition of channel b is enabled, this register specifies the num ber of execution times to make the break. the maximum number is 2 12 ? 1 times. when a break condition is satisfied, it decreas es betr. a user break interrupt is requested wh en the break condition is satisf ied after betr becomes h'0001. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/w - - - - bet[11:0] bit bit name initial value r/w description 15 to 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 to 0 bet[11:0] all 0 r/w number of execution times
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 142 of 1080 rej09b0230-0300 7.3.13 branch source register (brsr) brsr is a 32-bit read-only register. brsr stores bits 27 to 0 in the address of the branch source instruction. brsr has the flag bit that is set to 1 wh en a branch occurs. this flag bit is cleared to 0 when brsr is read, the setting to enable pc trace is made, or brsr is initialized by a power-on reset or manual reset. other bits are not initialized by a reset. the two brsr registers have a queue structure and a stored register is shifted at every branch. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000 - - - - - - - - - - - - rrrrrrrrrrrrrrrr ---------------- rrrrrrrrrrrrrrrr svf - - - bsa27 bsa26 bsa25 bsa24 bsa23 bsa22 bsa21 bsa20 bsa19 bsa18 bsa17 bsa16 bsa15 bsa14 bsa13 bsa12 bsa11 bsa10 bsa9 bsa8 bsa7 bsa6 bsa5 bsa4 bsa3 bsa2 bsa1 bsa0 bit bit name initial value r/w description 31 svf 0 r brsr valid flag indicates whether the branch source address is stored. this flag bit is set to 1 when a branch occurs. this flag is cleared to 0 when brsr is read, the setting to enable pc trace is made, or brsr is initialized by a power-on reset. 0: the value of brsr register is invalid 1: the value of brsr register is valid 30 to 28 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 27 to 0 bsa27 to bsa0 undefined r branch source address store bits 27 to 0 of the branch source address.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 143 of 1080 rej09b0230-0300 7.3.14 branch destination register (brdr) brdr is a 32-bit read-only register. brdr stores bits 27 to 0 in the address of the branch destination instruction. brdr has the flag bit that is set to 1 when a branch occurs. this flag bit is cleared to 0 when brdr is read, the setting to enable pc trace is made, or brdr is initialized by a power-on reset or manual reset. other bits are not initialized by a reset. the two brdr registers have a queue structure and a stored re gister is shifted at every branch. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000 - - - - - - - - - - - - rrrrrrrrrrrrrrrr ---------------- rrrrrrrrrrrrrrrr dvf - - - bda27 bda26 bda25 bda24 bda23 bda22 bda21 bda20 bda19 bda18 bda17 bda16 bda15 bda14 bda13 bda12 bda11 bda10 bda9 bda8 bda7 bda6 bda5 bda4 bda3 bda2 bda1 bda0 bit bit name initial value r/w description 31 dvf 0 r brdr valid flag indicates whether a branch destination address is stored. this flag bit is set to 1 when a branch occurs. this flag is cleared to 0 when brdr is read, the setting to enable pc trace is made, or brdr is initialized by a power-on reset. 0: the value of brdr register is invalid 1: the value of brdr register is valid 30 to 28 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 27 to 0 bda27 to bda0 undefined r branch destination address store bits 27 to 0 of the branch destination address.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 144 of 1080 rej09b0230-0300 7.4 operation 7.4.1 flow of the user break operation the flow from setting of break conditions to user break exception processing is described below: 1. the break addresses are set in the break a ddress registers (bara or barb). the masked addresses are set in the break address mask re gisters (bamra or bamrb). the break data is set in the break data register (bdra or bdrb). the masked data is set in the break data mask register (bdmra or bdmrb). the bus break conditions are set in the break bus cycle registers (bbra or bbrb). three groups of bbra or bbrb (l bus cycle/i bus cycle select, instruction fetch/data access select, and read/write select) are each set. no user break will be generated if even one of these groups is set with b'00. the respective conditions are set in the bits of the break control register (brcr). make sure to set all registers related to breaks before setting bbra or bbrb. 2. when the break conditions are satisfied, the ubc issues a user break interrupt request to the cpu and sets the l bus condition match flag (scmfca or scmfcb) and the i bus condition match flag (scmfda or scmfdb) for the appropriate channel. 3. the appropriate condition match flags (scmfca, scmfda, scmfcb, and scmfdb) can be used to check if the set conditions match or not. the matching of the conditions sets flags, but they are not reset. before using them again, 0 must first be written to them and then reset flags. 4. there is a possibility that matches of the break conditi ons set in channels a and b occur almost at the same time. in this case, only one user break interrupt request may be sent to the cpu with both of the two condition match flags set. 5. when selecting the i bus as the break condition, note the following: ? the cpu and dtc are connected to the i bus. the ubc monitors bus cycles generated by all bus masters that are selected by the cpa2 to cpa0 bits in bbra or the cpb2 to cpb0 bits in bbrb, and compares for a condition match. ? i bus cycles (including read fill cycles) resulting from instruction fetches on the l bus by the cpu are defined as instruction fetch cycl es on the i bus, while other bus cycles are defined as data access cycles. ? the dtc only issue data access cycles for i bus cycles. ? if a break condition is specified for the i bus, even when the condition matches in an i bus cycle resulting from an instruction executed by the cpu, at which instruction the break is to be accepted cannot be clearly defined.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 145 of 1080 rej09b0230-0300 7.4.2 user break on instruction fetch cycle 1. when l bus/instruction fetch/read/word, longword, or the operand size is not included is set in the break bus cycle register (bbra or bb rb), the break condition becomes the l bus instruction fetch cycle. whether a user break is set before or after the execution of the instruction can then be selected with the pcba or pcbb bit in the break control register (brcr) for the corresponding channel. if an instruction fetch cycle is set as a break condition, clear lsb in the break address register (bar a or barb) to 0. a user break cannot be generated as long as this bit is set to 1. 2. if the break condition matches when a user break on instruction fetch is specified so that the a break is generated before the execution of the instruction, the user break is generated at the point when it has become deterministic that the instruction will be executed after it is fetched. this means this feature cannot be used on instructions fetched by overrun (instructions fetched at a branch or during an interrupt transition, but not executed). when this kind of break condition is set for the delay slot of a delayed branch instruction, a user break is generated prior to execution of the delayed branch instruction. note: if a branch does not occur at a delay condition branch instruction, the subsequent instruction is not recognized as a delay slot. 3. when the break condition is specified so that a user break is generated after execution of the instruction, the instruction that has met the break condition is executed and then the user break is generated before the next instruction is executed. as with pre-execution user breaks, this cannot be used with overrun fetch instructions. when this kind of break condition is set for a delayed branch instruction and its delay slot, a user break is not generated until the processing jumps to the first instruction at the branch destination. 4. when an instruction fetch cycle is set, the break data register (bdra or bdrb) is ignored. therefore, break data cannot be set for the user break of the instruction fetch cycle. 5. if the i bus is set as the condition for a user break on instruction fetch cycle, the i bus is monitored for instruction fetch cycles to detect condition match. for details, see 5 in section 7.4.1, flow of the user break operation.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 146 of 1080 rej09b0230-0300 7.4.3 break on data access cycle 1. if the l bus is specified as a break cond ition for data access break, condition comparison is performed for the address (and data) accessed by th e executed instructions, and a user break is generated if the condition is satisfied. if the i bus is specified as a break condition, condition comparison is performed for the addresses (and da ta) of the data access cycles that are issued on the i bus by all bus masters including the cpu, and a user break is generated if the condition is satisfied. for details on the cpu bus cycles issued on the i bus, see 5 in section 7.4.1, flow of the user break operation. 2. the relationship between the data access cycle address and the comparison condition for each operand size is listed in table 7.3. table 7.3 data access cycle addresses and operand size comparison conditions access size address compared longword compares break address register bits 31 to 2 to address bus bits 31 to 2 word compares break address register bits 31 to 1 to address bus bits 31 to 1 byte compares break address register bits 31 to 0 to address bus bits 31 to 0 this means that when address h'00001003 is set in the break address register (bara or barb), for example, the bus cy cle in which the break condition is satisfied is as follows (where other conditions are met). longword access at h'00001000 word access at h'00001002 byte access at h'00001003 3. when the data value is included in the break conditions: when the data value is included in the break conditions, either longword, word, or byte is specified as the operand size of the break bus cycle register (bbra or bbrb). when data values are included in break conditions, a user break is generated when the address conditions and data conditions both match. to specify byte data for this case, set the same data in two bytes at bits 15 to 8 and bits 7 to 0 of the break data register (bdra or bdrb) and break data mask register (bdmra or bdmrb). when word or byte is set, bits 31 to 16 of bdra or bdrb and bdmra or bdmrb are ignored. 4. if the l bus is selected, a user break is generated on ending execution of the instruction that matches the break condition, and immediately before the next instruction is executed. however, when data is also specified as the break condition, the break may occur on ending execution of the instruction following the instruction that matches the break condition. when the i bus is selected, the instruction at which the user break is generated cannot be determined.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 147 of 1080 rej09b0230-0300 when this kind of break occurs at a delayed branch instruction or its delay slot, the break may not actually take place until the processing jumps to the first instruction at the branch destination. 7.4.4 sequential break 1. by setting the seq bit in brcr to 1, the sequential break is issued when a channel b break condition matches after a channel a break condition matches. a user break is not generated even if a channel b break condition matches before a channel a break condition matches. when channels a and b conditions match at the same time, the sequential break is not issued. to clear the channel a condition match when a channel a condition match has occurred but a channel b condition match has not yet occurred when a sequential break has been specified, clear the seq bit in brcr and channel a condition match flag to 0 by writing a 0 to them. 2. in sequential break specification, the l or i bus can be selected and the execution times break condition can be also specified. for example, when the execution times break condition is specified, the break condition is satisfied when a channel b condition matches with betr = h'0001 after a channel a condition has matched. 7.4.5 value of saved program counter when a user break occurs, the address of the instru ction from where execution is to be resumed is saved in the stack, and the exception handling state is entered. if the l bus is specified as the break condition, the instruction at which the user break should occur can be clearly determined (except for when data is included in the break condition). if the i bus is specified as a break condition, the instruction at which the user break should occur cannot be clearly determined. 1. when instruction fetch (before instruction execution) is specified as a break condition: the address of the instruction that matched the break condition is saved in the stack. the instruction that matched the condition is not executed, and the user break occurs before it. however when a delay slot instruction matches the condition, the address of the delayed branch instruction is saved in the stack. 2. when instruction fetch (after instruction execution) is specified as a break condition: the address of the instruction following the instruction that matched the break condition is saved in the stack. the instruction that matches the condition is executed, and the break occurs before the next instruction is executed. howeve r when a delayed branch instruction or delay slot matches the condition, these instructions are executed, and the branch destination address is saved in the stack.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 148 of 1080 rej09b0230-0300 3. when data access (address only) is specified as a break condition: the address of the instruction immediately af ter the instruction that matched the break condition is saved in the stack. the instruction that matches the condition is executed, and the user break occurs before the next instruc tion is executed. however when a delay slot instruction matches the condition, the branch destination address is saved in the stack. 4. when data access (address + data) is specified as a break condition: when a data value is added to the break conditions, the address of an instruction that is within two instructions of the instruction that matched the break condition is saved in the stack. at which instruction the user break occu rs cannot be determined accurately. when a delay slot instruction matches the condition, the branch destination address is saved in the stack. if the instruction following the instruction that matches the break condition is a branch instruction, the break may occur after the branch instruction or delay slot has finished. in this case, the branch destination address is saved in the stack. 7.4.6 pc trace 1. setting pcte in brcr to 1 enables pc traces. wh en branch (branch instruction, and interrupt exception) is generated, the branch source address and branch destination address are stored in brsr and brdr, respectively. 2. the values stored in brsr and brdr are as given below due to the kind of branch. ? if a branch occurs due to a branch instruction, the address of the branch instruction is saved in brsr and the address of the branch destination instruction is saved in brdr. ? if a branch occurs due to an interrupt or exception, the value saved in stack due to exception occurrence is saved in brsr and the start address of the exception handling routine is saved in brdr. 3. brsr and brdr have two pairs of queue structures. the top of queues is read first when the address stored in the pc trace register is r ead. brsr and brdr share the read pointer. read brsr and brdr in order, the queue only shifts after brdr is read. after switching the pcte bit (in brcr) off and on, the va lues in the queues are invalid. 4. since two pairs of queue are shared with th e aud, set the pcte bit in brcr to 1 after setting the mstp25 bit in stbcr5 to 0 and the audsrst bit in stbcr6 to 1. 5. a status of fifo is initialized by a power-on reset, manual reset, or aud software reset. when the status of fifo is initialized by a manual reset or an aud software reset, clear the pcte bit in the brcr register to 0 once, set the pcte bit to 1, and then th e pc trace can start.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 149 of 1080 rej09b0230-0300 7.4.7 usage examples break condition specified for l bus instruction fetch cycle: (example 1-1) ? register specifications bara = h'00000404, bamra = h'00000000, bbra = h' 0054, bdra = h'00000000, bdmra = h'00000000, barb = h'00008010, bamrb = h'00000006, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000400 specified conditions: channel a/channel b independent mode address: h'00000404, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (after in struction execution)/read (operand size is not included in the condition) address: h'00008010, address mask: h'00000006 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (before in struction execution)/read (operand size is not included in the condition) a user break occurs after an instruction of address h'00000404 is executed or before instructions of addresses h'00008010 to h'00008016 are executed. (example 1-2) ? register specifications bara = h'00037226, bamra = h'00000000, bbra = h' 0056, bdra = h'00000000, bdmra = h'00000000, barb = h'0003722e, bamrb = h'00000000, bbrb = h'0056, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000008 specified conditions: channel a/channel b sequential mode address: h'00037226, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (b efore instruction execution)/read/word
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 150 of 1080 rej09b0230-0300 address: h'0003722e, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (b efore instruction execution)/read/word after an instruction with address h'00037226 is executed, a user break occurs before an instruction with address h'0003722e is executed. (example 1-3) ? register specifications bara = h'00027128, bamra = h'00000000, bbra = h'005a, bdra = h'00000000, bdmra = h'00000000, barb = h'00031415, bamrb = h'00000000, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000000 specified conditions: channel a/channel b independent mode address: h'00027128, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (before instruction execution)/write/word address: h'00031415, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (before in struction execution)/read (operand size is not included in the condition) on channel a, no user break occurs since instruc tion fetch is not a write cycle. on channel b, no user break occurs since instruction fe tch is performed for an even address. (example 1-4) ? register specifications bara = h'00037226, bamra = h'00000000, bbra = h'005a, bdra = h'00000000, bdmra = h'00000000, barb = h'0003722e, bamrb = h'00000000, bbrb = h'0056, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000008 specified conditions: channel a/channel b sequential mode address: h'00037226, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (before instruction execution)/write/word
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 151 of 1080 rej09b0230-0300 address: h'0003722e, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (b efore instruction execution)/read/word since instruction fetch is not a write cycle on channel a, a sequential condition does not match. therefore, no user break occurs. (example 1-5) ? register specifications bara = h'00000500, bamra = h'00000000, bbra = h' 0057, bdra = h'00000000, bdmra = h'00000000, barb = h'00001000, bamrb = h'00000000, bbrb = h'0057, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000001, betr = h'0005 specified conditions: channel a/channel b independent mode address: h'00000500, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (before instruction execution)/read/longword the number of execution-times break enable (5 times) address: h'00001000, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (before instruction execution)/read/longword on channel a, a user break occurs after the instruction of address h'00000500 is executed four times and before the fifth time. on channel b, a user break occurs before an instruction of address h'00001000 is executed. (example 1-6) ? register specifications bara = h'00008404, bamra = h'00000fff, bbra = h'0054, bdra = h'00000000, bdmra = h'00000000, barb = h'00008010, bamrb = h'00000006, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000400 specified conditions: channel a/channel b independent mode address: h'00008404, address mask: h'00000fff data: h'00000000, data mask: h'00000000
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 152 of 1080 rej09b0230-0300 bus cycle: l bus/instruction fetch (after in struction execution)/read (operand size is not included in the condition) address: h'00008010, address mask: h'00000006 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (before in struction execution)/read (operand size is not included in the condition) a user break occurs after an instruction with addresses h'00008000 to h'00008ffe is executed or before an instruction with addresses h'00008010 to h'00008016 are executed. break condition specified fo r l bus data access cycle: (example 2-1) ? register specifications bara = h'00123456, bamra = h'00000000, bbra = h'0064, bdra = h'12345678, bdmra = h'ffffffff, barb = h'000abcde, bamrb = h'000000ff, bbrb = h'006a, bdrb = h'0000a512, bdmrb = h'00000000, brcr = h'00000080 specified conditions: channel a/channel b independent mode address: h'00123456, address mask: h'00000000 data: h'12345678, da ta mask: h'ffffffff bus cycle: l bus/data access/read (operand size is not included in the condition) address: h'000abcde, address mask: h'000000ff data: h'0000a512, data mask: h'00000000 bus cycle: l bus/data access/write/word on channel a, a user break occurs with longword read from address h'00123454, word read from address h'00123456, or byte read from address h'00123456. on channel b, a user break occurs when word h'a512 is written in addresses h'000abc00 to h'000abcfe.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 153 of 1080 rej09b0230-0300 break condition specified fo r i bus data access cycle: (example 3-1) ? register specifications bara = h'00314154, bamra = h'00000000, bbra = h' 0194, bdra = h'12345678, bdmra = h'ffffffff, barb = h'00055555, bamrb = h'00000000, bbrb = h'01a9, bdrb = h'00007878, bdmrb = h'00000f0f, brcr = h' 00000080 specified conditions: channel a/channel b independent mode address: h'00314154, address mask: h'00000000 data: h'12345678, da ta mask: h'ffffffff bus cycle: i bus (cpu cycle)/instruction fetc h/read (operand size is not included in the condition) address: h'00055555, address mask: h'00000000 data: h'00000078, data mask: h'0000000f bus cycle: i bus (cpu cycle)/data access/write/byte on channel a, a user break occurs when instruction fetch is performed for address h'00314156 in the external memory space. on channel b, a user break occurs when byte data h'7x is written in address h'00055555 in the external memory space by the cpu.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 154 of 1080 rej09b0230-0300 7.5 usage notes 1. the cpu can read from or write to the ubc registers via the i bus. accordingly, during the period from executing an instruction to rewrite the ubc register till the new value is actually rewritten, the desired user break may not occu r. in order to know the timing when the ubc register is changed, read from the last written register. instructions after then are valid for the newly written register value. 2. ubc cannot monitor access to the l bus and i bus in the same channel. 3. note on specification of sequential break: a condition match occurs when a b-channel matc h occurs in a bus cycle after an a-channel match occurs in another bus cycle in sequential break setting. therefore, no user break occurs if a bus cycle in which an a-channel match and a channel b match occur simultaneously is set. 4. when a user break and another exception occur at the same instruction, which has higher priority is determined according to the priority levels defined in table 5.1. if an exception with higher priority occurs, the user break is not generated. ? pre-execution break has the highest priority. ? when a post-execution break or data access break occurs simultaneously with a re- execution-type exception (including pre-execution break) that has higher priority, the re- execution-type exception is ac cepted, and the condition matc h flag is not set (see the exception in the following note). the user break will occur and the condition match flag will be set only after the exception source of the re-execution-type exception has been cleared by the exception handling routine and re-execution of the same instruction has ended. ? when a post-execution break or data acce ss break occurs simultaneously with a completion-type exception (trapa) that has higher priority, a user break does not occur but the condition match flag is set. 5. note the following ex ception for the above note. if a post-execution break or data access break is satisfied by an instruction that generates a cpu address error by data access, the cpu addre ss error takes priority over the user break. note that the ubc condition match flag is set in this case. 6. note the following when a user break occurs in a delay slot. if a pre-execution break is set at the delay slot instruction of the rte instruction, the user break does not occur until the branch destination of the rte instruction.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 155 of 1080 rej09b0230-0300 7. user breaks are disabled during ubc module standby mode. do not read from or write to the ubc registers during ubc module standby mode; the values are not guaranteed. 8. do not set a post-execution break at a sleep instruction or a branch instruction for which a sleep instruction is placed in th e delay slot. in addition, do not set a data access break at a sleep instruction or one or two instru ctions before a sleep instruction. 9. do not determine the breaks in an external space when the ubc is used in the mcu extension mode.
section 7 user break controller (ubc) rev. 3.00 oct. 06, 2008 page 156 of 1080 rej09b0230-0300
section 8 data transfer controller (dtc) dtchx10a_000020030600 rev. 3.00 oct. 06, 2008 page 157 of 1080 rej09b0230-0300 section 8 data transfer controller (dtc) this lsi includes a data transfer controller (dtc). the dtc can be activated to transfer data by an interrupt request. 8.1 features ? transfer possible over any number of channels ? chain transfer multiple rounds of data transfer is execu ted in response to a single activation source chain transfer is only possible after data transf er has been done for the specified number of times (i.e. when the transfer counter is 0) ? three transfer modes normal/repeat/blo ck transfer modes selectable transfer source and destination addresses can be selected from in crement/decrem ent/fixed ? the transfer source and destination addresses can be specified by 32 bits to select a 4-gbyte address space directly ? size of data for data transfer can be specified as byte, word, or longword ? a cpu interrupt can be requested for the interrupt that activated the dtc a cpu interrupt can be requested after one data transfer completion a cpu interrupt can be requested after the specified data transfer completion ? read skip of the transfer information specifiable ? write-back skip executed for the fixed tr ansfer source and destination addresses ? module stop mode specifiable figure 8.1 shows a block diagram of the dtc. the dtc transfer information can be allocated to the data area*. note: * when the transfer information is stored in the on-chip ram, the rame bit in ramcr must be set to 1.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 158 of 1080 rej09b0230-0300 bus interface interrupt source clear request dtc dtc internal bus peripheral bus internal bus (32 bits) external bus cpu interrupt request re g ister control cpu/dtc request determination interrupt control interrupt request on-chip memory mra mrb sar dar cra crb on-chip peripheral module external memory external device (memory mapped) bus state controller mra, mrb: sar: dar: cra, crb: dtcera to dtcere: dtccr: dtcvbr: dtc mode re g isters a, b dtc source address re g ister dtc destination address re g ister dtc transfer count re g isters a, b dtc enable re g isters a to e dtc control re g ister dtc vector base re g ister [le g end] dtcera to dtcere dtccr dtcvbr activation control intc figure 8.1 block diagram of dtc
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 159 of 1080 rej09b0230-0300 8.2 register descriptions dtc has the following registers. for details on the addresses of these registers and the states of these registers in each processing state, see section 24, list of registers. these six registers mra, mrb, sar, dar, cr a, and crb cannot be directly accessed by the cpu. the contents of these registers are stored in the data area as transfer information. when a dtc activation request occurs, the dt c reads a start address of transf er information that is stored in the data area according to the vector address, reads the transfer information, and transfers data. after the data transfer is complete, it writes a set of updated transfer information back to the data area. on the other hand, dtcera to dtcere, dtccr, and dtcvbr can be directly accessed by the cpu. table 8.1 register configuration register name abbrevia- tion r/w initial value address access size dtc enable register a dtcera r/w h'0000 h'ffffcc80 8, 16 dtc enable register b dtcerb r/w h'0000 h'ffffcc82 8, 16 dtc enable register c dtcerc r/w h'0000 h'ffffcc84 8, 16 dtc enable register d dtcerd r/w h'0000 h'ffffcc86 8, 16 dtc enable register e dtcere r/w h'0000 h'ffffcc88 8, 16 dtc control register dtccr r/w h'00 h'ffffcc90 8 dtc vector base register dtcvbr r/w h'00000000 h'ffffcc94 8, 16, 32 bus function extending register bscehr r/w h'0000 h'ffffe89a 8, 16
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 160 of 1080 rej09b0230-0300 8.2.1 dtc mode register a (mra) mra selects dtc operating mode. mra cannot be accessed directly by the cpu. bit: initial value: r/w: 7654321 0 -------- -------- md[1:0] sz[1:0] sm[1:0] - - bit bit name initial value r/w description 7, 6 md[1:0] undefined ? dtc mode 1 and 0 specify dtc transfer mode. 00: normal mode 01: repeat mode 10: block transfer mode 11: setting prohibited 5, 4 sz[1:0] undefined ? dtc data transfer size 1 and 0 specify the size of data to be transferred. 00: byte-size transfer 01: word-size transfer 10: longword-size transfer 11: setting prohibited 3, 2 sm[1:0] undefined ? source address mode 1 and 0 specify an sar operation after a data transfer. 0x: sar is fixed (sar write-back is skipped) 10: sar is incremented after a transfer (by 1 when sz1 and sz0 = b'00; by 2 when sz1 and sz0 = b'01; by 4 when sz1 and sz0 = b'10) 11: sar is decremented after a transfer (by 1 when sz1 and sz0 = b'00; by 2 when sz1 and sz0 = b'01; by 4 when sz1 and sz0 = b'10)
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 161 of 1080 rej09b0230-0300 bit bit name initial value r/w description 1, 0 ? undefined ? reserved the write value should always be 0. [legend] x: don't care 8.2.2 dtc mode register b (mrb) mrb selects dtc operating mode. mrb cannot be accessed directly by the cpu. bit: initial value: r/w: 7654321 0 -------- -------- chne chns disel dts dm[1:0] - - bit bit name initial value r/w description 7 chne undefined ? dtc chain transfer enable specifies the chain transfer. for details, see section 8.5.6, chain transfer. the chain transfer condition is selected by the chns bit. 0: disables the chain transfer 1: enables the chain transfer 6 chns undefined ? dtc chain transfer select specifies the chain transfer condition. if the following transfer is a chain transfer, the completion check of the specified transfer count is not performed and activation source flag or dtcer is not cleared. 0: chain transfer every time 1: chain transfer only when transfer counter = 0 5 disel undefined ? dtc interrupt select when this bit is set to 1, an interrupt request is generated to the cpu every time a data transfer or a block data transfer ends. when this bit is set to 0, a cpu interrupt request is only generated when the specified number of data transfers ends.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 162 of 1080 rej09b0230-0300 bit bit name initial value r/w description 4 dts undefined ? dtc transfer mode select specifies either the source or destination as repeat or block area during repeat or block transfer mode. 0: specifies the destination as repeat or block area 1: specifies the source as repeat or block area 3, 2 dm[1:0] undefined ? destination address mode 1 and 0 specify a dar operation after a data transfer. 0x: dar is fixed (dar write-back is skipped) 10: dar is incremented after a transfer (by 1 when sz1 and sz0 = b'00; by 2 when sz1 and sz0 = b'01; by 4 when sz1 and sz0 = b'10) 11: sar is decremented after a transfer (by 1 when sz1 and sz0 = b'00; by 2 when sz1 and sz0 = b'01; by 4 when sz1 and sz0 = b'10) 1, 0 ? undefined ? reserved the write value should always be 0. [legend] x: don't care
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 163 of 1080 rej09b0230-0300 8.2.3 dtc source address register (sar) sar is a 32-bit register that designates the source address of data to be transferred by the dtc. sar cannot be accessed directly from the cpu. bit: initial value: r/w: bit: initial value: r/w: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 : undefined * **************** ---------------- **************** ---------------- 8.2.4 dtc destination address register (dar) dar is a 32-bit register that designates the destination address of data to be transferred by the dtc. dar cannot be accessed directly from the cpu. bit: initial value: r/w: bit: initial value: r/w: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 : undefined * **************** ---------------- **************** ----------------
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 164 of 1080 rej09b0230-0300 8.2.5 dtc transfer count register a (cra) cra is a 16-bit register that designates the number of times data is to be transferred by the dtc. in normal transfer mode, cra functions as a 16-bit transfer counter (1 to 65,536). it is decremented by 1 every time data is transferred, and bit dtcen (n = 15 to 0) corresponding to the activation source is cleared and th en an interrupt is requested to the cpu when the count reaches h'0000. the transfer count is 1 when cra = h'0001, 65,535 when cra = h'ffff, and 65,536 when cra = h'0000. in repeat transfer mode, cra is divided into two parts: the upper eight bits (crah) and the lower eight bits (cral). crah holds the number of transfers while cral functions as an 8-bit transfer counter (1 to 256). cral is decremen ted by 1 every time data is transferred, and the contents of crah are sent to cral when the count reaches h'00. the transfer count is 1 when crah = cral = h'01, 255 when crah = cral = h'ff, and 256 when crah = cral = h'00. in block transfer mode, cra is divided into two parts: the upper eight bits (crah) and the lower eight bits (cral). crah holds the block size while cral functions as an 8-bit block-size counter (1 to 256 for byte, word, or longword). cral is decremented by 1 every time a byte (word or longword) data is transferred, and the contents of crah are sent to cral when the count reaches h'00. the block size is 1 byte (word or longword) when crah = cral =h'01, 255 bytes (words or longwords) when crah = cral = h'ff, and 256 bytes (words or longwords) when crah = cral =h'00. cra cannot be accessed directly from the cpu. bit: initial value: r/w: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 : undefined * **************** ----------------
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 165 of 1080 rej09b0230-0300 8.2.6 dtc transfer count register b (crb) crb is a 16-bit register that designates the number of times data is to be transferred by the dtc in block transfer mode. it functions as a 16-bit transfer counter (1 to 65,536) that is decremented by 1 every time a block of data is transferred, and bit dtcen (n = 15 to 0) corresponding to the activation source is cleared and th en an interrupt is requested to the cpu when the count reaches h'0000. the transfer count is 1 when crb = h' 0001, 65,535 when crb = h'ffff, and 65,536 when crb = h'0000. crb is not available in normal and repeat mode s and cannot be accessed directly by the cpu. bit: initial value: r/w: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 : undefined * **************** ----------------
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 166 of 1080 rej09b0230-0300 8.2.7 dtc enable registers a to e (dtcera to dtcere) dtcer which is comprised of eight registers, dt cera to dtcere, is a register that specifies dtc activation interrupt sources. the correspondence between interrupt sources and dtce bits is shown in table 8.2. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w dtce15 dtce14 dtce13 dtce12 dtce11 dtce10 dtce9 dtce8 dtce7 dtce6 dtce5 dtce4 dtce3 dtce2 dtce1 dtce0 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 dtce15 dtce14 dtce13 dtce12 dtce11 dtce10 dtce9 dtce8 dtce7 dtce6 dtce5 dtce4 dtce3 dtce2 dtce1 dtce0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w dtc activation enable 15 to 0 setting this bit to 1 specifies a relevant interrupt source to a dtc activation source. [clearing conditions] ? when writing 0 to the bit to be cleared after reading 1 ? when the disel bit is 1 and the data transfer has ended ? when the specified number of transfers have ended these bits are not cleared when the disel bit is 0 and the specified number of transfers have not ended [setting condition] ? writing 1 to the bit after reading 0
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 167 of 1080 rej09b0230-0300 8.2.8 dtc control register (dtccr) dtccr specifies transfer information read skip. bit: initial value: r/w: 7654321 0 00000000 r r r r/w r/w r r r/(w) * note: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. * - - - rrs rchne - - err bit bit name initial value r/w description 7 to 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 4 rrs 0 r/w dtc transfer information read skip enable controls the vector address read and transfer information read. a dtc vector number is always compared with the vector number for the previous activation. if the vector numbers match and this bit is set to 1, the dtc data transfer is started without reading a vector address and transfer information. if the previous dtc activation is a chain transfer, the vector address read and transfer information read are always performed. 0: transfer read skip is not performed. 1: transfer read skip is performed when the vector numbers match. 3 rchne 0 r/w chain transfer enable after dtc repeat transfer enables/disables the chain transfer while transfer counter (cral) is 0 in repeat transfer mode. in repeat transfer mode, the crah value is written to cral when cral is 0. accordingly, chain transfer may not occur when cral is 0. if this bit is set to 1, the chain transfer is enabled when crah is written to cral. 0: disables the chain transfer after repeat transfer 1: enables the chain transfer after repeat transfer 2, 1 ? all 0 r reserved these are read-only bits and cannot be modified.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 168 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 err 0 r/(w) * transfer stop flag indicates that a dtc address error or nmi interrupt has occurred. if a dtc address error or nmi interrupt occurs while the dtc is active, a dtc address error handling or nmi interrupt handling processing is executed after the dtc has released the bus mastership. the dtc transfers data and stops in the transfer information writing state. 0: no interrupt has occurred 1: an interrupt has occurred [clearing condition] ? when writing 0 after reading 1 note: * writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 8.2.9 dtc vector base register (dtcvbr) dtcvbr is a 32-bit register that specifies the ba se address for vector table address calculation. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/wr/wr/wr/wrrrrrrrrrrrr ------------ bit bit name initial value r/w description 31 to 12 all 0 r/w 11 to 0 ? all 0 r bits 11 to 0 are always read as 0. the write value should always be 0. 8.2.10 bus function extending register (bscehr) bscehr is a 16-bit register that specifies the tim ing of bus release by the dtc. for more details, see section 9.4.4, bus function extending register (bscehr).
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 169 of 1080 rej09b0230-0300 8.3 activation sources the dtc is activated by an interrupt request. th e interrupt source is selected by dtcer. a dtc activation source can be selected by setting the corresponding bit in dtcer; the cpu interrupt source can be selected by clearing the corresponding bit in dtcer. at the end of a data transfer (or the last consecutive transfer in the case of chain transfer), the ac tivation source interrupt flag or corresponding dtcer bit is cleared. 8.4 location of transfer inform ation and dtc vector table locate the transfer information in the data area. the start address of transfer information should be located at the address that is a multiple of four (4n). otherwise, the lower two bits are ignored during access ([1:0] = b'00.) transfer information located in the data area is shown in figure 8.2. the dtc reads the start address of transfer information from th e vector table according to the activation source, and then reads the transfer information from the start address. figure 8.3 shows correspondences between the dtc vector address and transfer information. mra mrb reserved (0 write) mra mrb reserved (0 write) sar dar cra crb cra crb sar dar lower addresses transfer information transfer information for one transfer (4 lon g words) transfer information for the 2nd transfer in chain transfer (4 lon g words) start address 4 bytes 1 03 2 chain transfer figure 8.2 transfer information on data area
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 170 of 1080 rej09b0230-0300 transfer information (1) start address transfer information (2) start address transfer information (n) start address vector table upper: dtcvbr lower: h'400 + vector number 4 dtc vector address +4 +4n transfer information (1) 4 bytes transfer information (2) transfer information (n) : : : : : : figure 8.3 correspondence between dtc v ector address and transfer information
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 171 of 1080 rej09b0230-0300 table 8.2 shows correspondence between the dtc activation source and vector address. table 8.2 interrupt sources, dtc vect or addresses, and corresponding dtces origin of activation source activation source vector number dtc vector address offset dtce * 1 transfer source transfer destination priority external pin irq0 64 h'500 dtcera15 any location * 2 any location * 2 high irq1 65 h'504 dtcera14 any location * 2 any location * 2 irq2 66 h'508 dtcera13 any location * 2 any location * 2 irq3 67 h'50c dtcera12 any location * 2 any location * 2 mtu2_0 tgia_0 88 h'560 dtcerb15 any location * 2 any location * 2 tgib_0 89 h'564 dtcerb14 any location * 2 any location * 2 tgic_0 90 h'568 dtcerb13 any location * 2 any location * 2 tgid_0 91 h'56c dtcerb12 any location * 2 any location * 2 mtu2_1 tgia_1 96 h'580 dtcerb11 any location * 2 any location * 2 tgib_1 97 h'584 dtcerb10 any location * 2 any location * 2 mtu2_2 tgia_2 104 h'5a0 dtcerb9 any location * 2 any location * 2 tgib_2 105 h'5a4 dtcerb8 any location * 2 any location * 2 mtu2_3 tgia_3 112 h'5c0 dtcerb7 any location * 2 any location * 2 tgib_3 113 h'5c4 dtcerb6 any location * 2 any location * 2 tgic_3 114 h'5c8 dtcerb5 any location * 2 any location * 2 tgid_3 115 h'5cc dtcerb4 any location * 2 any location * 2 mtu2_4 tgia_4 120 h'5e0 dtcerb3 any location * 2 any location * 2 tgib_4 121 h'5e4 dtcerb2 any location * 2 any location * 2 tgic_4 122 h'5e8 dtcerb1 any location * 2 any location * 2 tgid_4 123 h'5ec dtcerb0 any location * 2 any location * 2 tciv_4 124 h'5f0 dtcerc15 any location * 2 any location * 2 low
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 172 of 1080 rej09b0230-0300 origin of activation source activation source vector number dtc vector address offset dtce * 1 transfer source transfer destination priority mtu2s_3 tgia_3s 160 h'680 dtcerc3 any location * 2 any location * 2 high tgib_3s 161 h'684 dtcerc2 any location * 2 any location * 2 tgic_3s 162 h'688 dtcerc1 any location * 2 any location * 2 tgid_3s 163 h'68c dtcerc0 any location * 2 any location * 2 mtu2s_4 tgia_4s 168 h'6a0 dtcerd15 any location * 2 any location * 2 tgib_4s 169 h'6a4 dtcerd14 any location * 2 any location * 2 tgic_4s 170 h'6a8 dtcerd13 any location * 2 any location * 2 tgid_4s 171 h'6ac dtcerd12 any location * 2 any location * 2 tciv_4s 172 h'6b0 dtcerd11 any location * 2 any location * 2 mtu2s_5 tgiu_5s 176 h'6c0 dtcerd10 any location * 2 any location * 2 tgiv_5s 177 h'6c4 dtcerd9 any location * 2 any location * 2 tgiw_5s 178 h'6c8 dtcerd8 any location * 2 any location * 2 cmt_0 cmi_0 184 h'6e0 dtcerd7 any location * 2 any location * 2 cmt_1 cmi_1 188 h'6f0 dtcerd6 any location * 2 any location * 2 a/d_0 adi_3 208 h'740 dtcerd2 addr0 to addr7 any location * 2 a/d_1 adi_4 212 h'750 dtcerd1 addr8 to addr15 any location * 2 sci_0 rxi_0 217 h'764 dtcere15 scrdr_0 any location * 2 txi_0 218 h'768 dtcere14 any location * 2 sctdr_0 sci_1 rxi_1 221 h'774 dtcere13 scrdr_1 any location * 2 txi_1 222 h'778 dtcere12 any location * 2 sctdr_1 sci_2 rxi_2 225 h'784 dtcere11 scrdr_2 any location * 2 txi_2 226 h'788 dtcere10 any location * 2 sctdr_2 low
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 173 of 1080 rej09b0230-0300 origin of activation source activation source vector number dtc vector address offset dtce * 1 transfer source transfer destination priority ssrxi 233 h'7a4 dtcere7 ssrdr0 to ssrdr3 any location * 2 high synchronous serial communication unit sstxi 234 h'7a8 dtcere6 any location * 2 sstdr0 to sstdr3 rcan-et_0 rm0_0 242 h'7c8 dtcere3 control0h to control1l * 3 any location * 2 rcan-et_1 * 4 rm0_1 246 h'7d8 dtcere2 control0h to control1l * 3 any location * 2 low notes: 1. the dtce bits with no corresponding interrupt are reserved, and the write value should always be 0. to leave software standby mode with an interrupt, write 0 to the corresponding dtce bit. 2. an external memory, a memory-mapped external device, an on-chip memory, or an on- chip peripheral module (except for dtc, bsc, ubc, aud, and flash) can be selected as the source or destination. note that at least either the source or destination must be an on-chip peripheral module; transfer cannot be done among an external memory, a memory-mapped external device, and an on-chip memory. 3. read to a message control field in mailbox 0 by using a block transfer mode or etc. 4. available only in the sh7142.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 174 of 1080 rej09b0230-0300 8.5 operation there are three transfer modes: normal, repeat, and block. since transfer information is in the data area, it is possible to transfer data over any requ ired number of channels. when activated, the dtc reads the transfer information stor ed in the data area and transfer s data according to the transfer information. after the data transfer is complete, it writes updated transfer information back to the data area. the dtc specifies the source address and destin ation address in sar and dar, respectively. after a transfer, sar and dar are incremented, decremented, or fixed independently. table 8.3 shows the dtc transfer modes. table 8.3 dtc transfer modes transfer mode size of data transferred at one transfer request memory address increment or decrement transfer count normal 1 byte/word/longword incremented/decremented by 1, 2, or 4, or fixed 1 to 65536 repeat * 1 1 byte/word/longword incremented/decremented by 1, 2, or 4, or fixed 1 to 256 * 3 block * 2 block size specified by crah (1 to 256 bytes/words/longwords) incremented/decremented by 1, 2, or 4, or fixed 1 to 65536 * 4 notes: 1. either source or desti nation is specified to repeat area. 2. either source or destination is specified to block area. 3. after transfer of the specified transfer c ount, initial state is recovered to continue the operation. 4. number of transfers of the specified block size of data setting the chne bit in mrb to 1 makes it possible to perform a number of transfers with a single activation (chain transfer). setting the chns bit in mrb to 1 can also be made to have chain transfer performed only when th e transfer counter value is 0. figure 8.4 shows a flowchart of dtc operation, and table 8.4 summarizes the conditions for dtc transfers including chain transfer (combinations for performing the second and third transfers are omitted).
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 175 of 1080 rej09b0230-0300 start match & rrs = 1 not match | rrs = 0 next transfer read transfer information transfer data update transfer information update the start address of transfer information write transfer information chne = 1 transfer counter = 0 or disel = 1 clear activation source fla g end chns = 0 transfer counter = 0 disel = 1 clear dtcer/request an interrupt to the cpu no no no no no yes yes yes yes yes vector number comparison read dtc vector figure 8.4 flowchart of dtc operation
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 176 of 1080 rej09b0230-0300 table 8.4 dtc transfer conditions (chain transfer conditions included) 1st transfer 2nd transfer transfer mode chne chns rchne disel transfer counter * 1 chne chns rchne disel transfer counter * 1 dtc transfer 0 ? ? 0 not 0 ? ? ? ? ? ends at 1st transfer 0 ? ? 0 0 ? ? ? ? ? 0 ? ? 1 ? ? ? ? ? ? ends at 1st transfer interrupt request to cpu 1 0 ? ? ? 0 ? ? 0 not 0 ends at 2nd transfer 0 ? ? 0 0 0 ? ? 1 ? ends at 2nd transfer interrupt request to cpu 1 1 ? 0 not 0 ? ? ? ? ? ends at 1st transfer 1 1 ? 1 not 0 ? ? ? ? ? ends at 1st transfer interrupt request to cpu 1 1 ? ? 0 0 ? ? 0 not 0 ends at 2nd transfer 0 ? ? 0 0 normal 0 ? ? 1 ? ends at 2nd transfer interrupt request to cpu
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 177 of 1080 rej09b0230-0300 1st transfer 2nd transfer transfer mode chne chns rchne disel transfer counter * 1 chne chns rchne disel transfer counter * 1 dtc transfer 0 ? ? 0 ? ? ? ? ? ? ends at 1st transfer 0 ? ? 1 ? ? ? ? ? ? ends at 1st transfer interrupt request to cpu 1 0 ? ? ? 0 ? ? 0 ? ends at 2nd transfer 0 ? ? 1 ? ends at 2nd transfer interrupt request to cpu 1 1 ? 0 not 0 ? ? ? ? ? ends at 1st transfer 1 1 ? 1 not 0 ? ? ? ? ? ends at 1st transfer interrupt request to cpu 1 1 0 0 0 * 2 ? ? ? ? ? ends at 1st transfer 1 1 0 1 0 * 2 ? ? ? ? ? ends at 1st transfer interrupt request to cpu repeat 1 1 1 ? 0 * 2 0 ? ? 0 ? ends at 2nd transfer 0 ? ? 1 ? ends at 2nd transfer interrupt request to cpu
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 178 of 1080 rej09b0230-0300 1st transfer 2nd transfer transfer mode chne chns rchne disel transfer counter * 1 chne chns rchne disel transfer counter * 1 dtc transfer block 0 ? ? 0 not 0 ? ? ? ? ? ends at 1st transfer 0 ? ? 0 0 ? ? ? ? ? 0 ? ? 1 ? ? ? ? ? ? ends at 1st transfer interrupt request to cpu 1 0 ? ? ? 0 ? ? 0 not 0 ends at 2nd transfer 0 ? ? 0 0 0 ? ? 1 ? ends at 2nd transfer interrupt request to cpu 1 1 ? 0 ? ? ? ? ? ? ends at 1st transfer 1 1 ? 1 not 0 ? ? ? ? ? ends at 1st transfer interrupt request to cpu 1 1 ? 1 0 0 ? ? 0 not 0 ends at 2nd transfer 0 ? ? 0 0 0 ? ? 1 ? ends at 2nd transfer interrupt request to cpu notes: 1. cra in normal mode transfer, cral in re peat transfer mode, or crb in block transfer mode 2. when the contents of the crah is written to the cral
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 179 of 1080 rej09b0230-0300 8.5.1 transfer information read skip function by setting the rrs bit of dtccr, the vector addr ess read and transfer information read can be skipped. the current dtc vector number is always compared with the vector number of previous activation. if the vector numbers match when rrs = 1, a dtc data transfer is performed without reading the vector address and tran sfer information. if the previous activation is a chain transfer, the vector address read and transfer information read are always performed. figure 8.5 shows the transfer information read skip timing. to modify the vector table and transfer information, temporarily clear the rrs bit to 0, modify the vector table and transfer informa tion, and then set the rrs bit to 1 again. when the rrs bit is cleared to 0, the stored vector number is deleted, and the updated vector table and transfer information are read at the next activation. vector read transfer information read data transfer transfer information write data transfer transfer information write note: the dtc request si g nal indicates the state of internal bus request after the dtc activation source has been determined. internal address dtc activation request dtc request skip transfer information read clock (b ) rw rw figure 8.5 transfer information read skip timing (activated by on-chip peripheral module; i : b : p = 1 : 1/2 : 1/2; data transferred from on-chip peri pheral module to on-chip ram; transfer information is written in 3 cycles)
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 180 of 1080 rej09b0230-0300 8.5.2 transfer information write-back skip function by specifying bit sm1 in mra and bit dm1 in mrb to the fixed address mode, a part of transfer information will not be written back. table 8.5 shows the transfer information write-back skip condition and write-back skipped registers. note that the cra and crb are always written back. the write-back of the mra and mrb are always skipped. table 8.5 transfer information write-back skip condition and write-back skipped registers sm1 dm1 sar dar 0 0 skipped skipped 0 1 skipped written back 1 0 written back skipped 1 1 written back written back 8.5.3 normal transfer mode in normal transfer mode, data are transferred in one byte, one word, or one longword units in response to a single activation request. from 1 to 65,536 transfers can be specified. the transfer source and destination addresses can be specified as incremented, decremented, or fixed. when the specified number of transfers ends, an interrupt can be requested to the cpu. table 8.6 lists the register function in normal transfer mode. figure 8.6 shows the memory map in normal transfer mode. table 8.6 register function in normal transfer mode register function written back value sar source address incremented/decremented/fixed * dar destination address incremented/decremented/fixed * cra transfer count a cra ? 1 crb transfer count b not updated note: * transfer information write-back is skipped.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 181 of 1080 rej09b0230-0300 sar transfer source data area dar transfer transfer destination data area figure 8.6 memory map in normal transfer mode 8.5.4 repeat transfer mode in repeat transfer mode, data are transferred in one byte, one word, or one longword units in response to a single activation request. by the dts bit in mrb, either the source or destination can be specified as a repeat area. from 1 to 25 6 transfers can be specified. when the specified number of transfers ends, the transfer counter and address register specified as the repeat area is restored to the initial state, and transfer is repeated. the other address register is then incremented, decremented, or left fixed. in repeat transfer mode, the transfer counter (cral) is updated to the value specified in crah when cra l becomes h'00. thus the transfer counter value does not reach h'00, and therefore a cpu interrupt cannot be requested when disel = 0. table 8.7 lists the register function in repeat transfer mode. figure 8.7 shows the memory map in repeat transfer mode.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 182 of 1080 rej09b0230-0300 table 8.7 register function in repeat transfer mode written back value register function cral is not 1 cral is 1 sar source address incremented/decremented/fixed * dts = 0: incremented/ decremented/fixed * dts = 1: sar initial value dar destination address incremented/decremented/fixed * dts = 0: dar initial value dts = 1: incremented/ decremented/fixed * crah transfer count storage crah crah cral transfer count a cral ? 1 crah crb transfer count b not updated not updated note: * transfer information write-back is skipped. sar transfer source data area (specified as repeat area) dar transfer transfer destination data area figure 8.7 memory map in repeat transfer mode (when transfer source is specified as repeat area)
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 183 of 1080 rej09b0230-0300 8.5.5 block transfer mode in block transfer mode, data are transferred in block units in response to a single activation request. either the transfer source or the transfer destination is designated as a block area by the dts bit in mrb. the block size is 1 to 256 bytes (1 to 256 words, or 1 to 256 longwords). when transfer of one block of data ends, the block size counter (cral) and address register (sar when dts = 1 or dar when dts = 0) for the area specified as the block area are initialized. the other address register is then incremented, decremented, or left fixed. from 1 to 65,536 transfers can be specified. when the specified number of transfers ends, an interrupt is requested to the cpu. table 8.8 lists the register function in block transfer mode. figure 8.8 shows the memory map in block transfer mode. table 8.8 register function in block transfer mode register function written back value sar source address dts = 0: incremented/decremented/fixed * dts = 1: sar initial value dar destination address dts = 0: dar initial value dts = 1: incremented/decremented/fixed * crah block size storage crah cral block size counter crah crb block transfer counter crb ? 1 note: * transfer information write-back is skipped.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 184 of 1080 rej09b0230-0300 transfer source data area transfer destination data area (specified as block area) block area dar sar : : : transfer 1st block nth block figure 8.8 memory map in block transfer mode (when transfer destination is specified as block area) 8.5.6 chain transfer setting the chne bit in mrb to 1 enables a number of data transfers to be performed consecutively in response to a single transfer re quest. setting the chne and chns bits in mrb set to 1 enables a chain transfer only when the transfer counter reaches 0. sar, dar, cra, crb, mra, and mrb, which define data transfers, can be set independently. figure 8.9 shows the chain transfer operation. in the case of transfer with chne set to 1, an interrupt request to the cpu is not generated at the end of the specified number of transfers or by setting the disel bit to 1, and the interrupt source flag for the activation source and dtcer are not affected. in repeat transfer mode, setting the rchne bit in dtccr and the chne and chns bits in mrb to 1 enables a chain transfer af ter transfer with transfer counter = 1 has been completed.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 185 of 1080 rej09b0230-0300 transfer information chne = 1 transfer information chne = 0 transfer information stored in user area data area transfer source data (1) transfer destination data (1) transfer source data (2) transfer destination data (2) transfer information start address vector table dtc vector address figure 8.9 operation of chain transfer
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 186 of 1080 rej09b0230-0300 8.5.7 operation timing figures 8.10 to 8.12 show the dtc operation timings. internal address vector read transfer information read data transfer transfer information write note: the dtc request si g nal indicates the state of internal bus request after the dtc activation source has been determined. dtc activation request dtc request clock (b ) rw figure 8.10 example of dtc operation timing: normal transfer mode or repeat transfer mode (activated by on-chip peripheral module; i : b : p = 1 : 1/2 : 1/2; data transferred from on-chip peri pheral module to on-chip ram; transfer information is written in 3 cycles) internal address vector read transfer information read data transfer transfer information write note: the dtc request si g nal indicates the state of internal bus request after the dtc activation source has been determined. dtc activation request dtc request clock (b ) rw rw figure 8.11 example of dtc operation timing: block transfer mode with block size = 2 (activated by on-chip peripheral module; i : b : p = 1 : 1/2 : 1/2; data transferred from on-chip peri pheral module to on-chip ram; transfer information is written in 3 cycles)
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 187 of 1080 rej09b0230-0300 internal address vector read transfer information read transfer information read data transfer transfer information write data transfer transfer information write note: the dtc request si g nal indicates the state of internal bus request after the dtc activation source has been determined. dtc activation request dtc request clock (b ) rw r w figure 8.12 example of dtc operation timing: chain transfer (activated by on-chip peripheral module; i : b : p = 1 : 1/2 : 1/2; data transferred from on-chip peri pheral module to on-chip ram; transfer information is written in 3 cycles) 8.5.8 number of dtc execution cycles table 8.9 shows the execution status for a single dtc data transfer, and table 8.10 shows the number of cycles required for each execution. table 8.9 dtc execution status mode vector read i transfer information read j transfer information write k data read l data write m internal operation n normal 1 0 * 1 4 0 * 1 3 2 * 2 1 * 3 1 1 1 0 * 1 repeat 1 0 * 1 4 0 * 1 3 2 * 2 1 * 3 1 1 1 0 * 1 block transfer 1 0 * 1 4 0 * 1 3 2 * 2 1 * 3 1?p 1?p 1 0 * 1 [legend] p: block size (crah and cral value) notes: 1. when transfer information read is skipped 2. when the sar or dar is in fixed mode 3. when the sar and dar are in fixed mode
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 188 of 1080 rej09b0230-0300 table 8.10 number of cycles requ ired for each execution state object to be accessed on-chip ram * 1 /rom * 2 on-chip i/o registers external device * 4 bus width 32 bits 16 bits 8 bits access cycles 1b to 3b * 1 * 2 2p 2b vector read s i 1b to 3b * 1 * 2 ? 9b transfer information read s j 1b to 3b * 1 ? 9b execu- tion status transfer information write s k 1b to 3b * 1 ? 2b * 5 byte data read s l 1b to 3b * 1 1b + 2p * 3 3b word data read s l 1b to 3b * 1 1b + 2p * 3 5b longword data read s l 1b to 3b * 1 1b + 4p * 3 9b byte data write s m 1b to 3b * 1 1b + 2p * 3 2b * 5 word data write s m 1b to 3b * 1 1b + 2p * 3 2b * 5 longword data write s m 1b to 3b * 1 1b + 4p * 3 2b * 5 internal operation s n 1 notes: 1. values for on-chip ram. number of cycles varies depending on the ratio of i :b . read write i :b = 1:1 3b 3b i :b = 1:1/2 2b 1b i :b = 1:1/3 2b 1b i :b = 1:1/4 or less 1b 1b 2. values for on-chip rom. number of cycles varies depending on the ratio of i :b .and are the same as on-chip ram. only vector read is possible. 3. the values in the table are those for the fastest case. depending on the state of the internal bus, replace 1b by 1p in a slow case. 4. values are different depending on the bsc register setting. the values in the table are the sample for the case with no wait cycles and the wm bit in csnwcr = 1. 5. values are different depending on the bus state. the number of cycles increases when many external wait cycles are inserted in the case where writing is frequently executed, such as block transfer, and when the external bus is in use because the write buffer cannot be used efficiently in such cases. for details on the write buffer, see section 9.5.7 (2), access in view of lsi internal bus master.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 189 of 1080 rej09b0230-0300 the number of execution cycles is calcula ted from the formula below. note that means the sum of cycles for all transfers initiated by one activation event (the number of 1-valued chne bits in transfer information plus 1). number of execution cycles = i ? s i + (j ? s j + k ? s k + l ? s l + m ? s m ) + n ? s n 8.5.9 dtc bus release timing the dtc requests the bus mastership to the bus arbiter when an activation request occurs. the dtc releases the bus after a vector read, transf er information read, a single data transfer, or transfer information write-back. the dtc does no t release the bus mastership during transfer information read, a single data transfer, or write-back of transfer information. the bus release timing can be specified through the bus function extending register (bscehr). for details see section 9.4.4, bus function extending register (bscehr). the difference in bus release timing according to the register setting is summarized in table 8.11. the value of bscehr must not be modified while the dtc is active. figure 8.13 is a timing chart showing an example of bus release timing. table 8.11 dtc bus release timing bus function extending register (bscehr) setting bus release timing (o: bus must be released; : bus is released depending on the cpu execution status, x: bus is not released) after write-back of transfer information bit 15 (dtlock) after vector read nop issuance * after transfer information read after a single data transfer normal transfer continuous transfer setting 1 1 o o o o setting 2 0 x o x x o o note: * bus is only released for the external access request from the cpu after a vector read.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 190 of 1080 rej09b0230-0300 vector read transfer information read data transfer transfer information write vector read transfer information read data transfer transfer information write [le g end] clock (b ) internal address : indicates bus mastership release timin g . : indicates bus mastership release timin g that may occur dependin g on the cpu execution status. dtc activation request 2 dtc request bus release timin g dtlock = 1 bus release timin g dtlock = 0 dtc activation request 1 r w r w note: dtc request si g nal indicates the state of internal bus request after the dtc activation source is determined. : bus mastership is only released for the external access request from the cpu after a vector read. figure 8.13 example of dtc operation timing: conflict of two activation requests in normal transfer mode (activated by on-chip peripheral module; i : b : p = 1 : 1/2 : 1/2; data transferred from on-chip peri pheral module to on-chip ram; transfer information is written in 3 cycles)
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 191 of 1080 rej09b0230-0300 8.5.10 dtc activation priority order if multiple dtc activation requests are generate d while the dtc is inactive, the dtc starts transfer for the requesting sources in the order of activation request generation. on the other hand, if multiple activation requests are generated while the dtc is active, transfer is performed according to the pr iority order for dtc activation. figure 8.14 shows an example of dtc activation according to the priority. transfer is started for the request that is g enerated first transfer is performed accordin g to the priority internal bus priority determination other than dtc dtc is inactive dtc is active dtc (request 3) dtc (request 1) dtc (request 2) dtc activation request 1 (hi g h priority) dtc activation request 2 (medium priority) dtc activation request 3 (low priority) figure 8.14 dtc activation in accordance with priority
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 192 of 1080 rej09b0230-0300 8.6 dtc activation by interrupt the procedure for using the dtc with interrupt activation is shown in figure 8.15. clearin g the rrs bit in dtccr to 0 clears the read skip fla g of transfer information. read skip is not performed when the dtc is activated after clearin g the rrs bit. when updatin g transfer information, the rrs bit must be cleared. set the mra, mrb, sar, dar, cra, and crb transfer information in the data area. for details on settin g transfer information, see section 8.2, re g ister descriptions. for details on location of transfer information, see section 8.4, location of transfer information and dtc vector table. set the start address of the transfer information in the dtc vector table. for details on settin g dtc vector table, see section 8.4, location of transfer information and dtc vector table. settin g the rrs bit to 1 performs a read skip of second time or later transfer information when the dtc is activated consecu- tively by the same interrupt source. settin g the rrs bit to 1 is always allowed. however, the value set durin g transfer will be valid from the next transfer. set the bit in dtcer correspondin g to the dtc activation interrupt source to 1. for the correspondence of interrupts and dtcer, refer to table 8.2. the bit in dtcer may be set to 1 on the second or later transfer. in this case, settin g the bit is not needed. set the enable bits for the interrupt sources to be used as the activation sources to 1. the dtc is activated when an interrupt used as an activation source is g enerated. for details on the settin g s of the interrupt enable bits, see the correspondin g descriptions of the correspondin g module. after the end of one data transfer, the dtc clears the activation source fla g or clears the correspondin g bit in dtcer and requests an interrupt to the cpu. the operation after transfer depends on the transfer information. for details, see section 8.2, re g ister descriptions and fi g ure 8.4. dtc activation by interrupt clear rrs bit in dtccr to 0 set transfer information (mra, mrb, sar, dar, cra, crb) set starts address of transfer information in dtc vector table set rrs bit in dtccr to 1 set correspondin g bit in dtcer to 1 set enable bit of interrupt request for activation source to 1 interrupt request g enerated dtc activated correspondin g bit in dtcer cleared or cpu interrupt requested transfer end [1] [2] [3] [4] [5] [6] [7] [1] [2] [3] [4] [5] [6] [7] determine clearin g method of activation source clear activation source clear correspondin g bit in dtcer figure 8.15 dtc activation by interrupt
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 193 of 1080 rej09b0230-0300 8.7 examples of use of the dtc 8.7.1 normal transfer mode an example is shown in which the dtc is used to receive 128 bytes of data via the sci. 1. set mra to fixed source address (sm1 = sm0 = 0), incrementing destination address (dm1 = 1, dm0 = 0), normal transfer mode (md1 = md0 = 0), and byte size (sz1 = sz0 = 0). the dts bit can have any value. set mrb for one data transfer by one interrupt (chne = 0, disel = 0). set the rdr address of the sci in sar, the start address of the ram area where the data will be received in dar, and 128 (h'0080) in cra. crb can be set to any value. 2. set the start address of the transfer information for an rxi interrupt at the dtc vector address. 3. set the corresponding bit in dtcer to 1. 4. set the sci to the appropriate receive mode. se t the rie bit in scr to 1 to enable the receive end (rxi) interrupt. since the generation of a receive er ror during the sci reception operation will disable subsequent reception, the cpu should be enabled to accept receive error interrupts. 5. each time reception of one byte of data ends on the sci, the rdrf flag in ssr is set to 1, an rxi interrupt is generated, and the dtc is activated. the receive data is transferred from rdr to ram by the dtc. dar is incremented and cra is decremented. the rdrf flag is automatically cl eared to 0. 6. when cra becomes 0 after the 128 data transfers have ended, the rdrf flag is held at 1, the dtce bit is cleared to 0, and an rxi interrupt request is sent to the cpu. termination processing should be performed in the interrupt handling routine. 8.7.2 chain transfer when transfer counter = 0 by executing a second data transfer and performing re-setting of the first data transfer only when the counter value is 0, it is possible to perform 256 or more repeat transfers. an example is shown in which a 128-kbyte input buffer is configured. the input buffer is assumed to have been set to start at lower address h'0000. figure 8.16 shows the chain transfer when the counter value is 0. 1. for the first transfer, set the normal transfer mode for input data. set the fixed transfer source address, cra = h'0000 (65,536 times), chne = 1, chns = 1, and disel = 0. 2. prepare the upper 8-bit addresses of the start addresses for 65,536-transfer units for the first data transfer in a separate area (in rom, etc.). for example, if the input buffer is configured at addresses h'200000 to h'21ffff, prepare h'21 and h'20.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 194 of 1080 rej09b0230-0300 3. for the second transfer, set repeat transfer mode (with the source side as the repeat area) for re- setting the transfer destination address for the first data transfer. use the upper eight bits of dar in the first transfer information area as the transfer destination. set chne = disel = 0. if the above input buffer is specified as h'2000 00 to h'21ffff, set the tr ansfer counter to 2. 4. execute the first data transfer 65536 times by means of interrupts. when the transfer counter for the first data transfer reaches 0, the second data transfer is started. set the upper eight bits of the transfer source address for the first data transfer to h'21. the lower 16 bits of the transfer destination address of the first data transfer and the transfer counter are h'0000. 5. next, execute the first data transfer the 6553 6 times specified for the first data transfer by means of interrupts. when the tr ansfer counter for the first data transfer reaches 0, the second data transfer is started. set the upper eight bits of the transfer source address for the first data transfer to h'20. the lower 16 bits of the transfer destination address of the first data transfer and the transfer counter are h'0000. 6. steps 4 and 5 are repeated endlessly. as repeat mode is specified for the second data transfer, no interrupt request is sent to the cpu. 1st data transfer information 2nd data transfer information transfer information located on the on-chip memory chain transfer (counter = 0) input circuit input buffer upper 8 bits of dar figure 8.16 chain transfer when transfer counter = 0
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 195 of 1080 rej09b0230-0300 8.8 interrupt sources an interrupt request is issued to the cpu when the dtc finishes the specified number of data transfers, or on completion of a single data transf er or a single block data transfer with the disel bit set to 1. in the case of interrupt activation, the interrupt set as the activation source is generated. these interrupts to the cpu are subject to cpu mask level and priority level control in the interrupt controller. for details, refer to section 6.8, data transfer with interrupt request signals.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 196 of 1080 rej09b0230-0300 8.9 usage notes 8.9.1 module standby mode setting operation of the dtc can be disabled or enab led using the standby control register. the initial setting is for operation of the dtc to be disabled. dtc operation is disabled in module standby mode but register access is available. however, do not place the dtc in module standby mode while it is active. before entering software standby mode or module standby mode, all dtcer registers must be cleared. for details, refer to section 22, power-down modes. 8.9.2 on-chip ram transfer information can be locat ed in on-chip ram. in this case, the rame bit in ramcr must not be cleared to 0. 8.9.3 dtce bit setting to set a dtce bit, disable the corresponding interrupt, read 0 from the bit, and then write 1 to it. while dtc transfer is in progress, do not modify the dtce bits. 8.9.4 chain transfer when chain transfer is used, clearing of the ac tivation source or dtcer is performed when the last of the chain of data transfers is executed. sci, synchronous serial communication unit, rcan-et, and a/d converter interrupt/activation sources, on the other hand, are cleared when the dtc reads or writes to the relevant register. therefore, when the dtc is activat ed by an interrupt or activation source, if a read/write of the relevant register is not included in the last chained data transfer, the interrupt or activation source will be retained. 8.9.5 transfer information start address, so urce address, and destination address the transfer information start addr ess to be specified in the vector table should be address 4n. transfer information should be placed in on-chip ram or external memory space. 8.9.6 access to dtc registers through dtc do not access the dtc register s by using dtc operation.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 197 of 1080 rej09b0230-0300 8.9.7 notes on irq interrupt as dtc activation source ? the irq interrupt specified as a dtc activation source must not be used to cancel software standby mode. ? the irq edge input in software standby mode must not be specified as a dtc activation source. ? when a low level on the irq pin is to be detected, if the end of dtc transfer is used to request an interrupt to the cpu (transfer counter = 0 or disel = 1), the irq signal must be held low until the cpu accepts the interrupt. 8.9.8 note on sci as dtc activation sources ? when the txi interrupt from the sci is specifi ed as a dtc activation source, the tend flag in the sci must not be used as the transfer end flag. 8.9.9 clearing interrupt source flag the interrupt source flag set when the dtc transfer is completed should be cleared in the interrupt handler in the same way as for general interrupt source flags. for details, refer to section 6.9, usage note. 8.9.10 conflict between nmi interrupt and dtc activation when a conflict occurs between the generation of the nmi interrupt and the dtc activation, the nmi interrupt has priority. thus the err bit is set to 1 and the dtc is not activated. it takes 1 bcyc + 3 pcyc for checking dtc stop by the nmi, 2 bcyc for checking dtc activation by the irq, and 1 pcyc for checking dtc activation by the peripheral module.
section 8 data transfer controller (dtc) rev. 3.00 oct. 06, 2008 page 198 of 1080 rej09b0230-0300 8.9.11 operation when dtc activa tion request is accepted once the dtc has accepted an activation request , the dtc does not accept the next activation request until the sequence of dtc processing that ends with writeback has been completed.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 199 of 1080 rej09b0230-0300 section 9 bus state controller (bsc) the bus state controller (bsc) outputs control signals for various types of memory that is connected to the external address space and extern al devices. bsc functions enable this lsi to connect directly with sram and other memory storage devices and external devices. 9.1 features 1. external address space ? a maximum 64 mbytes for each of two areas, cs0 and cs1 ? can select the data bus width (8 bits) for each address space ? controls the insertion of the wait state for each address space. ? controls the insertion of the wait st ate for each read access and write access ? can set the independent idling cycle in the co ntinuous access for five cases: read-write (in same space/different space), read-r ead (in same space/different space), the first cycle is a write access. 2. normal space interface ? supports the interface that can di rectly connect to the sram
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 200 of 1080 rej09b0230-0300 figure 9.1 shows a block diagram of the bsc. cmncr cs0wcr cs1wcr cs0bcr cs1bcr bus mastership controller wait controller area controller internal master module internal slave module internal bus memory controller [le g end] module bus bsc cs0 , cs1 wait a19 to a0, d7 to d0 back breq rd , wrl cmncr: csnwcr: csnbcr: common control re g ister csn space wait control re g ister (n = 0 and 1) csn space bus control re g ister (n = 0 and 1) figure 9.1 block diagram of bsc
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 201 of 1080 rej09b0230-0300 9.2 input/output pins the pin configuration of the bsc is listed in table 9.1. table 9.1 pin configuration name i/o function a19 to a0 output address bus d7 to d0 i/o data bus cs0 and cs1 output chip select rd output read pulse signal (read data output enable signal) wrl output indicates byte write through d7 to d0. wait input external wait input breq input bus request input back output bus acknowledge output
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 202 of 1080 rej09b0230-0300 9.3 area overview 9.3.1 area division in the architecture, this lsi has 32-bit address spaces. as listed in tables 9.2 to 9.5, this lsi can connect two areas to each type of memory, and it outputs chip select signals ( cs0 and cs1 ) for each of them. cs0 is asserted during area 0 access. 9.3.2 address map the external address space has a capacity of 128 m bytes and is used by dividing into two spaces. the memory to be connected and the data bus wi dth are specified in each space. the address map for the entire address space is listed in tables 9.2 to 9.5. table 9.2 (1) address map (256-kbyte on-chip rom/12-kbyte on-chip ram, on-chip rom-enabled mode) address area memory type capacity bus width h'00000000 to h'0003ffff on-chip rom 256 kbytes 32 bits h'00040000 to h'01ffffff reserved h'02000000 to h'03ffffff cs0 space normal space 32 mbytes 8 bits h'04000000 to h'07ffffff cs1 space normal space 64 mbytes 8 bits h'08000000 to h'ffff8fff reserved h'ffff9000 to h'ffffbfff on-chip ram 12 kbytes 32 bits h'ffffc000 to h'ffffffff on-chip peripheral modules 16 kbytes 8 or 16 bits note: do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. in single-chip mode, only the on-chip rom, on-chip ram, and on- chip peripheral modules can be accessed; the other areas cannot be accessed.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 203 of 1080 rej09b0230-0300 table 9.2 (2) address map (256-kbyte on-chip rom/12-kbyte on-chip ram, on-chip rom-disabled mode) address area memory type capacity bus width h'00000000 to h'03ffffff cs0 space normal space 64 mbytes 8 bits h'04000000 to h'07ffffff cs1 space normal space 64 mbytes 8 bits h'08000000 to h'ffff8fff reserved h'ffff9000 to h'ffffbfff on-chip ram 12 kbytes 32 bits h'ffffc000 to h'ffffffff on-chip peripheral modules 16 kbytes 8 or 16 bits note: do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. table 9.3 (1) address map (256-kbyte on-chip rom/16-kbyte on-chip ram, on-chip rom-enabled mode) address area memory type capacity bus width h'00000000 to h'0003ffff on-chip rom 256 kbytes 32 bits h'00040000 to h'01ffffff reserved h'02000000 to h'03ffffff cs0 space normal space 32 mbytes 8 bits h'04000000 to h'07ffffff cs1 space normal space 64 mbytes 8 bits h'08000000 to h'ffff7fff reserved h'ffff8000 to h'ffffbfff on-chip ram 16 kbytes 32 bits h'ffffc000 to h'ffffffff on-chip peripheral modules 16 kbytes 8 or 16 bits note: do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. in single-chip mode, only the on-chip rom, on-chip ram, and on- chip peripheral modules can be accessed; the other areas cannot be accessed.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 204 of 1080 rej09b0230-0300 table 9.3 (2) address map (256-kbyte on-chip rom/16-kbyte on-chip ram, on-chip rom-disabled mode) address area memory type capacity bus width h'00000000 to h'03ffffff cs0 space normal space 64 mbytes 8 bits h'04000000 to h'07ffffff cs1 space normal space 64 mbytes 8 bits h'08000000 to h'ffff7fff reserved h'ffff8000 to h'ffffbfff on-chip ram 16 kbytes 32 bits h'ffffc000 to h'ffffffff on-chip peripheral modules 16 kbytes 8 or 16 bits note: do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. table 9.4 (1) address map (384-kbyte on-chip rom/16-kbyte on-chip ram, on-chip rom-enabled mode) address area memory type capacity bus width h'00000000 to h'0005ffff on-chip rom 384 mbytes 32 bits h'00060000 to h'01ffffff reserved h'02000000 to h'03ffffff cs0 space normal space 32 mbytes 8 bits h'04000000 to h'07ffffff cs1 space normal space 64 kbytes 8 bits h'08000000 to h'ffff7fff reserved h'ffff8000 to h'ffffbfff on-chip ram 16 kbytes 32 bits h'ffffc000 to h'ffffffff on-chip peripheral modules 16 kbytes 8 or 16 bits note: do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. in single-chip mode, only the on-chip rom, on-chip ram, and on- chip peripheral modules can be accessed; the other areas cannot be accessed.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 205 of 1080 rej09b0230-0300 table 9.4 (2) address map (384-kbyte on-chip rom/16-kbyte on-chip ram, on- chip rom-disabled mode) address area memory type capacity bus width h'00000000 to h'03ffffff cs0 space normal space 64 mbytes 8 bits h'04000000 to h'07ffffff cs1 space normal space 64 mbytes 8 bits h'08000000 to h'ffff7fff reserved h'ffff8000 to h'ffffbfff on-chip ram 16 kbytes 32 bits h'ffffc000 to h'ffffffff on-chip peripheral modules 16 kbytes 8 or 16 bits note: do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. table 9.5 (1) address map (512-kbyte on-chip rom/16-kbyte on-chip ram, on-chip rom-enabled mode) address area memory type capacity bus width h'00000000 to h'0007ffff on-chip rom 512 kbytes 32 bits h'00080000 to h'01ffffff reserved h'02000000 to h'03ffffff cs0 space normal space 32 mbytes 8 bits h'04000000 to h'07ffffff cs1 space normal space 64 mbytes 8 bits h'08000000 to h'ffff7fff reserved h'ffff8000 to h'ffffbfff on-chip ram 16 kbytes 32 bits h'ffffc000 to h'ffffffff on-chip peripheral modules 16 kbytes 8 or 16 bits note: do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. in single-chip mode, only the on-chip rom, on-chip ram, and on- chip peripheral modules can be accessed; the other areas cannot be accessed.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 206 of 1080 rej09b0230-0300 table 9.5 (2) address map (512-kbyte on-chip rom/16-kbyte on-chip ram, on-chip rom-disabled mode) address area memory type capacity bus width h'00000000 to h'03ffffff cs0 space normal space 64 mbytes 8 bits h'04000000 to h'07ffffff cs1 space normal space 64 mbytes 8 bits h'08000000 to h'ffff7fff reserved h'ffff8000 to h'ffffbfff on-chip ram 16 kbytes 32 bits h'ffffc000 to h'ffffffff on-chip peripheral modules 16 kbytes 8 or 16 bits note: do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 207 of 1080 rej09b0230-0300 9.4 register descriptions the bsc has the following registers. refer to section 24, list of registers, for details on the register addresses and register states in each operating mode. do not access spaces other than cs0 until the termination of the memory interface setting. table 9.6 register configuration register name abbrevia- tion r/w initial value address access size common control register cmncr r/w h'00001010 h'fffff000 32 cs0 space bus control register cs0bcr r/w h'36db0600 h'fffff004 32 cs1 space bus control register cs1bcr r/w h'36db0600 h'fffff008 32 cs0 space wait control register cs0wcr r/w h'00000500 h'fffff028 32 cs1 space wait control register cs1wcr r/w h'00000500 h'fffff02c 32 bus function extending register bscehr r/w h'0000 h'ffffe89a 8, 16 9.4.1 common control register (cmncr) cmncr is a 32-bit register that cont rols the common items for each area. do not access external memory other than area 0 until the register initialization is complete. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 rrrrrrrrrrrrrrrr 0001000000010000 rrrrrrrrrrrrrrr/wr - --- ---------------- -------- --- hizmem
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 208 of 1080 rej09b0230-0300 bit bit name initial value r/w description 31 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 12 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 11 to 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 4 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 hizmem 0 r/w hi-z memory control specifies the pin state in software standby mode for a19 to a0, csn , wrl , and rd . while the bus is released, these pins are in high-impedance state regardless of this bit setting. 0: high impedance in software standby mode 1: driven in software standby mode 0 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 209 of 1080 rej09b0230-0300 9.4.2 csn space bus control register (csnbcr) (n = 0 and 1) csnbcr is a 32-bit readable/writable register that specifies the data bus width of the respective space and the number of wait cycles between access cycles. do not access external memory other than area 0 until the register initialization is complete. bit: initial value: r/w: bit name: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 000 rrr 0011011011011011 r r r/w r/w r r/w r/w r r/w r/w r r/w r/w r r/w r/w 0 011000000000 r r r/w r/w r r r r r r r r r --- - - iww[1:0] - iwrwd[1:0] - iwrws[1:0] - iwrrd[1:0] - iwrrs[1:0] - - bsz[1:0] - - - - - - - - - bit bit name initial value r/w description 31, 30 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 29, 28 iww[1:0] 11 r/w specification for idle cycles between write-read/write- write cycles specify the number of idle cycles to be inserted after access to memory that is connected to the space. the target cycles are write-read cycles and write-write cycles. 00: no idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 4 idle cycles inserted 27 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 210 of 1080 rej09b0230-0300 bit bit name initial value r/w description 26, 25 iwrwd[1:0] 11 r/w specification for idle cycles between read-write cycles in different spaces specify the number of idle cycles to be inserted after access to memory that is connected to the space. the target cycles are continuous read-write cycles in different spaces. 00: no idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 4 idle cycles inserted 24 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 23, 22 iwrws[1:0] 11 r/w specification for idle cycles between read-write cycles in the same space specify the number of idle cycles to be inserted after access to memory that is connected to the space. the target cycles are continuous read-write cycles in the same space. 00: no idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 4 idle cycles inserted 21 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 20, 19 iwrrd[1:0] 11 r/w specification for idle cycles between read-read cycles in different spaces specify the number of idle cycles to be inserted after access to memory that is connected to the space. the target cycles are continuous read-read cycles in different spaces. 00: no idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 4 idle cycles inserted
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 211 of 1080 rej09b0230-0300 bit bit name initial value r/w description 18 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 17, 16 iwrrs[1:0] 11 r/w specification for idle cycles between read-read cycles in the same space specify the number of idle cycles to be inserted after access to memory that is connected to the space. the target cycles are continuous read-read cycles in the same space. 00: no idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 4 idle cycles inserted 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10, 9 bsz[1:0] 11 r/w data bus size specification specify the data bus sizes of spaces. when the on-chip rom is enabled, write b'01 to these bits to specify the 8-bit data bus width before accessing the csn space. note: when the on-chip rom is disabled, the data bus width in area 0 is specified through external input pins. the bsz1 and bsz0 bit setting in cs0bcr is ignored. 8 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 212 of 1080 rej09b0230-0300 9.4.3 csn space wait control register (csnwcr) (n = 0 and 1) csnwcr specifies various wait cycles for memo ry accesses. specify csnwcr before accessing the target area. csnwcr should be modified only after csnbcr setting is completed. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 rrrrrrrrrrrrrr/wr/wr/w 0000010100000000 r r r r/w r/w r/w r/w r/w r/w r/w r r r r r/w r/w - - - - - - - - - - - - - ww[2:0] - - - sw[1:0] wr[3:0] wm - - - - hw[1:0] bit bit name initial value r/w description 31 to 19 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 18 to 16 ww[2:0] 000 r/w number of wait cycles in write access specify the number of cycles required for write access. 000: the same cycles as wr3 to wr0 settings (read access wait) 001: 0 cycles 010: 1 cycle 011: 2 cycles 100: 3 cycles 101: 4 cycles 110: 5 cycles 111: 6 cycles 15 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 213 of 1080 rej09b0230-0300 bit bit name initial value r/w description 12, 11 sw[1:0] 00 r/w number of delay cycles from address and csn assertion to rd and wrl assertion specify the number of delay cycles from address and csn assertion to rd and wrl assertion. 00: 0.5 cycle 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles 10 to 7 wr[3:0] 1010 r/w number of read access wait cycles specify the number of wait cycles required for read access. 0000: 0 cycles 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycles is 0. 0: external wait input is valid 1: external wait input is ignored
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 214 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1, 0 hw[1:0] 00 r/w delay cycles from rd and wrl negation to address and csn negation specify the number of delay cycles from rd and wrl negation to address and csn negation. 00: 0.5 cycle 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles 9.4.4 bus function extending register (bscehr) bscehr is a 16-bit register that specifi es the timing of bus release by the dtc. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/wrrrrrrrrrrrrrrr dtlock --------------- bit bit name initial value r/w description 15 dtlock 0 r/w dtc lock enable specifies the timing of bus release by the dtc. 0: the dtc releases the bus on issuance of nop after vector read or write-back of transfer information. 1: the dtc releases the bus after vector read, on issuance of nop after vector read, after transfer information read, after a single data transfer, or after write-back of transfer information. 14 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 215 of 1080 rej09b0230-0300 9.5 operation 9.5.1 endian/access size and data alignment this lsi supports big endian, in which the 0 address is the most significant byte (msb) in the byte data. the data bus width is 8 bits. data alignment is performed in accordance with the data bus width of the respective device. this also means that when longword data is read from a byte-width device, the read operation must be done four times. in this lsi, data alignment and conversion of data length are performed automatically between the respective interfaces. table 9.7 shows the relationship betw een device data width and access unit. table 9.7 8-bit external devi ce access and data alignment data bus strobe signals operation d7 to d0 wrl byte access at 0 data 7 to data 0 assert byte access at 1 data 7 to data 0 assert byte access at 2 data 7 to data 0 assert byte access at 3 data 7 to data 0 assert 1st time at 0 data 15 to data 8 assert word access at 0 2nd time at 1 data 7 to data 0 assert 1st time at 2 data 15 to data 8 assert word access at 2 2nd time at 3 data 7 to data 0 assert 1st time at 0 data 31 to data 24 assert 2nd time at 1 data 23 to data 16 assert longword access at 0 3rd time at 2 data 15 to data 8 assert 4th time at 3 data 7 to data 0 assert
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 216 of 1080 rej09b0230-0300 9.5.2 normal space interface basic timing: for access to a normal space, this lsi uses st robe signal output in consideration of the fact that mainly sram without a byte sel ection will be directly connected. figure 9.2 shows the basic timings of normal space access. a no-wa it normal access is completed in two cycles. read write ck a19 to a0 d7 to d0 csn t1 t2 rd wrl d7 to d0 figure 9.2 normal space basic access timing (access wait 0) there is no access size specification when reading. the correct access start address is output in the least significant bit of the addre ss, but since there is no access size specification, 8 bits are always read. when writing, only the wrl signal for the byte to be written is asserted. it is necessary to control of outputing the data that has been read using rd when a buffer is established in the data bus.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 217 of 1080 rej09b0230-0300 figures 9.3 and 9.4 show the basic timings of c ontinuous accesses to normal space. if the wm bit in csnwcr is cleared to 0, a tnop cycle is inserted to evaluate the external wait (figure 9.3). if the wm bit in csnwcr is set to 1, external waits are ignored and no tnop cycle is inserted (figure 9.4). read write ck a19 to a0 rd d7 to d0 wrl d7 to d0 wait csn t1 t2 tnop t1 t2 figure 9.3 continuous access for normal space 1 bus width = 8 bits, longword access, wm bit in csnwcr = 0 (access wait = 0, cycle wait = 0)
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 218 of 1080 rej09b0230-0300 read write ck a19 to a0 d7 to d0 csn t1 t2 t1 t2 rd wrl wait d7 to d0 figure 9.4 continuous access for normal space 2 bus width = 8 bits, longword access, wm bit in csnwcr = 1 (access wait = 0, cycle wait = 0) this lsi 128 k 8 bits sram a16 a0 cs oe i/o7 i/o0 we . . . a16 a0 csn rd d7 d0 wrl . . . . . . . . . figure 9.5 example of 8-bit data-width sram connection
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 219 of 1080 rej09b0230-0300 9.5.3 access wait control wait cycle insertion on a normal space access can be controlled by the settings of bits wr3 to wr0 in csnwcr. it is possible to insert wait cy cles independently in read access and in write access. the specified number of tw cycles is in serted as wait cycles in a normal space access shown in figure 9.6. read write t1 ck a19 to a0 csn rd d7 to d0 wrl d7 to d0 tw t2 figure 9.6 wait timing for norm al space access (software wait only)
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 220 of 1080 rej09b0230-0300 when the wm bit in csnwcr is cleared to 0, the external wait input wait signal is also sampled. wait pin sampling is shown in figure 9.7. a 2-cycle wait is specified as a software wait. the wait signal is sampled at the falling edge of ck at the transition from the t1 or tw cycle to the t2 cycle. read write t1 ck a19 to a0 csn rd d7 to d0 wrl d7 to d0 wait tw tw twx t2 wait states inserted by wait si g nal figure 9.7 wait state ti ming for normal space access (wait state insertion using wait signal)
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 221 of 1080 rej09b0230-0300 9.5.4 csn assert period extension the number of cycles from csn assertion to rd , wrl assertion can be specified by setting bits sw1 and sw0 in csnwcr. the number of cycles from rd , wrl negation to csn negation can be specified by setting bits hw1 and hw0. theref ore, a flexible interface to an external device can be obtained. figure 9.8 shows an example. a th cycle and a tf cycle are added before and after an ordinary cycle, re spectively. in these cycles, rd and wrl are not asserted, while other signals are asserted. the data output is prolonged to the tf cycle, and this prolongation is useful for devices with slow writing operations. read write t1 ck a19 to a0 csn rd d7 to d0 wrl d7 to d0 th t2 tf figure 9.8 csn assert period extension
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 222 of 1080 rej09b0230-0300 9.5.5 wait between access cycles as the operating frequency of lsis becomes highe r, the off-operation of the data buffer often collides with the next data output when the data output from devices with slow access speed is completed. as a result of these collisions, the reliability of the device is low and malfunctions may occur. a function that avoids data collisions by inserting wait cycles between continuous access cycles has been newly added. the number of wait cycles between access cycles can be set by bits iww[1:0], iwrwd[1:0], iwrws[1:0], iwrrd[1:0], and iwrrs[1:0] in csnbcr. the conditions for setting the wait cycles between access cycles (i dle cycles) are shown below. 1. continuous accesses are write-read or write-write 2. continuous accesses are read-write for different spaces 3. continuous accesses are read-write for the same space 4. continuous accesses are read-read for different spaces 5. continuous accesses are read-read for the same space besides the wait cycles between access cycles (idle cycles) described above, idle cycles must be inserted to reserve the minimum pulse width for a multiplexed pin ( wrl ), and an interface with an internal bus. 6. idle cycle of the external bus fo r the interface with the internal bus a. insert one idle cycle imme diately before a write access cycl e after an external bus idle cycle or a read cycle. b. insert one idle cycle to tran sfer the read data to the intern al bus when a read cycle of the external bus terminates. insert two to three idle cycles including the id le cycle in a. for the write cycle immediately after a read cycle. tables 9.8 and 9.9 list the minimum number of idle cycles to be inserted. the csnbcr idle setting column in the tables describes the number of idle cycles to be set for iww, iwrwd, iwrws, iwrrd, and iwrrs.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 223 of 1080 rej09b0230-0300 table 9.8 minimum number of idle cycles between cpu access cycles in normal space interface bsc register setting when access size is less than bus width when access size exceeds bus width csnwcr. wm setting csnbcr idle setting read to read write to write read to write write to read contin- uous read * 1 contin- uous write * 1 read to read * 2 write to write * 2 read to write * 2 write to read * 2 1 0 1/1/1/1 0/0/0/0 3/3/3/4 0/0/0/0 0/0/0/ 0 0/0/0/0 1/1/1/1 0/0/0/0 3/3/3/4 0/0/0/0 0 0 1/1/1/1 1/1/1/1 3/3/3/4 1/1/1/1 1/1/1/ 1 1/1/1/1 1/1/1/1 1/1/1/1 3/3/3/4 1/1/1/1 1 1 1/1/1/1 1/1/1/1 3/3/3/4 1/1/1/1 1/1/1/ 1 1/1/1/1 1/1/1/1 1/1/1/1 3/3/3/4 1/1/1/1 0 1 1/1/1/1 1/1/1/1 3/3/3/4 1/1/1/1 1/1/1/ 1 1/1/1/1 1/1/1/1 1/1/1/1 3/3/3/4 1/1/1/1 1 2 2/2/2/2 2/2/2/2 3/3/3/4 2/2/2/2 2/2/2/ 2 2/2/2/2 2/2/2/2 2/2/2/2 3/3/3/4 2/2/2/2 0 2 2/2/2/2 2/2/2/2 3/3/3/4 2/2/2/2 2/2/2/ 2 2/2/2/2 2/2/2/2 2/2/2/2 3/3/3/4 2/2/2/2 1 4 4/4/4/4 4/4/4/4 4/4/4/4 4/4/4/4 4/4/4/ 4 4/4/4/4 4/4/4/4 4/4/4/4 4/4/4/4 4/4/4/4 0 4 4/4/4/4 4/4/4/4 4/4/4/4 4/4/4/4 4/4/4/ 4 4/4/4/4 4/4/4/4 4/4/4/4 4/4/4/4 4/4/4/4 notes: the minimum numbers of idle cycles are described sequentially for i :b = 4:1, 3:1, 2:1, and 1:1. 1. minimum number of idle cycles between the upper and lower 16-bit access cycles in the 32-bit access cycle when the bus width is 16 bits 2. other than the above cases
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 224 of 1080 rej09b0230-0300 table 9.9 minimum number of idle cycles between access cycles during dtc transfer for the normal space interface bsc register setting when access size is less than bus width when access size exceeds bus width csnwcr. wm setting csnbcr idle setting read to write write to read continuous read * 1 read to write * 2 continuous write * 1 write to read * 2 1 0 2 0 0 2 0 0 0 0 2 1 1 2 1 1 1 1 2 1 1 2 1 1 0 1 2 1 1 2 1 1 1 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 1 4 4 4 4 4 4 4 0 4 4 4 4 4 4 4 notes: dtc is operated by b . the minimum number of idle cycles is not affected by changing a clock ratio. 1. minimum number of idle cycles between the upper and lower 16-bit access cycles in the 32-bit access cycle when the bus width is 16 bits 2. other than the above cases. 9.5.6 bus arbitration this lsi owns the bus mastership in normal stat e and releases the bus only when receiving a bus request from an external device. this lsi has three bus masters: cpu, aud, and dtc. the bus mastership is given to these bus master s in accordance with th e following priority. request for bus mastership by external device ( breq ) > cpu > aud > dtc however, when dtc or aud is requesting the bus mastership, the cpu does not obtain the bus mastership continuously. the external space access request from the cpu is noted as follow. when an activation request is generated in the order of dtc and aud while an external space is being accessed by the cpu, dtc transfer is executed first. figure 9.9 shows the bus arbitration when the aud and dtc compet e while an external sp ace is accessed by the cpu.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 225 of 1080 rej09b0230-0300 aud dtc priority determination priority determination aud dtc aud dtc transfer is started for the request that is g enerated first transfer is started for the request that is g enerated first transfer is started in accordance with the bus priority (aud>dtc) transfer is started in accordance with the bus priority (aud>dtc) internal bus external space access from cpu external space access from cpu external space access from cpu access to on-chip peripheral module from cpu dtc aud aud activation request ? when activation request is g enerated in the order of dtc and aud durin g external space access from cpu [reference] when activation request is g enerated in the order of dtc and aud durin g access to an on-chip peripheral module by cpu ? when activation request is g enerated in the order of aud and dtc durin g external space access from cpu ? when activation request is g enerated for aud and dtc at the same time durin g external space access from cpu dtc activation request internal bus aud activation request dtc activation request internal bus aud activation request dtc activation request internal bus aud activation request dtc activation request figure 9.9 bus arbitration when dtc and aud compete during external space access from cpu
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 226 of 1080 rej09b0230-0300 in addition, because the write buffer operates as described in section 9.5.7 (2), access in view of lsi internal bus master, arbitration between the cpu and aud/dtc is different depending on whether the external space access by the cpu is a write or read access. figure 9.10 shows the bus arbitration when a aud or dtc activation request is generated while an external space is accessed by cpu.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 227 of 1080 rej09b0230-0300 dtc/aud dtc/aud dtc/aud read access to external space from cpu read access to external space from cpu write to external space from cpu write to external space from cpu write to external space 1 from cpu write access to external space 1 from cpu write to external space 2 from cpu write access to external space 2 from cpu write access to external space from cpu write access to external space from cpu read access to external space from cpu read access to external space from cpu dtc/aud activation request is g enerated in this period. dtc/aud activation request is g enerated in this period. dtc/aud activation request is g enerated in this period. dtc/aud activation request is g enerated in this period. dtc/aud internal bus external bus external bus external bus external bus ? when dtc/aud activation request is g enerated durin g read access to external space from cpu ? when dtc/aud activation request is g enerated durin g write access to external space from cpu (1) ? when dtc/aud activation request is g enerated durin g write access to external space from cpu (2) (when external space read request is g enerated by cpu durin g execution of write access to external space from cpu) ? when dtc/aud activation request is g enerated durin g write access to external space from cpu (3) (when external space write request is g enerated by cpu durin g execution of write access to external space from cpu) dtc/aud activation request dtc/aud activation request dtc/aud activation request dtc/aud activation request internal bus internal bus internal bus figure 9.10 bus arbitration when dtc or aud activation request occur during external space access from cpu
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 228 of 1080 rej09b0230-0300 the states that do not allow bus arbitration are shown below. 1. between the read and write cycles of a tas instruction 2. multiple bus cycles generated when the data bus width is smaller than the access size (for example, between bus cycles when longword acce ss is made to a memory with a data bus width of 8 bits) to prevent device malfunction while the bus mastersh ip is transferred to the external device, the lsi negates all of the bus control signals before bus release. when the bus mastership is received, all of the bus control signals are first negated and then driven appropriately. in addition, to prevent noise while the bus control signal is in the high impedance state, pull-up resistors must be connected to these control signals. bus mastership is transferred to the external device at the boundary of bus cycles. namely, bus mastership is released immediat ely after receiving a bus request when a bus cycle is not being performed. the release of bus mastership is delayed until the bus cycle is complete when a bus cycle is in progress. even when from outside the lsi it looks like a bus cycle is not being performed, a bus cycle may be performing internally, started by inserting wait cycles between access cycles. therefore, it cannot be immediately determined whether or not bus mastership has been released by looking at the csn signal or other bus control signals. the external bus release by the breq and back signal handshaking requires some overhead. if the slave has many tasks, multiple bus cycles shoul d be executed in a bus mastership acquisition. reducing the cycles required for master to slave bu s mastership transitions streamlines the system design. the lsi has the bus mastership until a bus request is received from the external device. upon acknowledging the assertion (low level) of the external bus request signal breq , the lsi releases the bus at the completion of the current bus cycle and asserts the back signal. after the lsi acknowledges the negation (high level) of the breq signal that indicates the slave has released the bus, it negates the back signal and resumes the bus usage. while the bus is released, sleep mode, software standby mode, and deep software standby mode cannot be entered. the bus release sequence is as follows. the address bus and data bus are placed in a high- impedance state synchronized with the rising edge of ck. the bus mastership acknowledge signal is asserted 0.5 cycles after the above high impeda nce state, synchronized with the falling edge of ck. the bus control signals such as csn are placed in the high-impedance state at subsequent rising edges of ck. these bus control signals go high one cycle before being placed in the high- impedance state. bus request signals are sampled at the falling edge of ck.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 229 of 1080 rej09b0230-0300 the sequence for reclaiming the bus mastership fr om an external device is described below. at 1.5 cycles after the negation of breq is detected at the falling edge of ck, the bus control signals are driven high. the bus acknowledge signa l is negated at the next falling edge of the clock. the fastest timing at which actual bus cycles can be resumed after bus control signal assertion is at the rising edge of the ck where address and data signals are driven. figure 9.11 shows the bus arbitration timing in master mode. after breq assertion (low level; bus request), the breq signal should be negated (high level; bus release) only after the back is asserted (low level; bus acknowledge). if breq is negated before back is asserted, back may be asserted only for one cycle depending on the breq negation timing, and a bus conflict may occur between the external device and this lsi. ck other bus control si g nals breq back a19 to a0 d7 to d0 csn figure 9.11 bus arbitration timing
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 230 of 1080 rej09b0230-0300 9.5.7 others (1) reset the bus state controller (bsc) can be initialized completely only at a power-on reset. at a power- on reset, all signals are negated and output buffers are turned off regardless of the bus cycle state. all control registers are initialized. in standby, sleep, and manual reset, control regist ers of the bus state cont roller are not initialized. at a manual reset, the current bus cycle being ex ecuted is completed and then the access wait state is entered. however, a bus arbitration request by the breq signal cannot be accepted during manual reset signal assertion. (2) access in view of lsi internal bus master there are three types of lsi internal buses: l bus, i bus, and peripheral bus. the cpu is connected to the l bus. the dtc and bus state c ontroller are connected to the i bus. low-speed peripheral modules are connected to the peripheral bus. on-chip memories are connected bidirectionally to the l bus and i bus. for an access of an external space or an on-chip peripheral module, the access is initiated via the i bus. thus, the dtc can be activated without bus arbitration with the cpu while the cpu is accessing an on-chip memory. since the bus state controller (bsc) incorporates a one-stage write buffer, the bsc can execute an access via the i bus before the previous external bu s cycle is completed in a write cycle. if the on- chip peripheral module is read or written after the external low-speed memory is written, the on- chip peripheral module can be accessed before th e completion of the exte rnal low-speed memory write cycle. in read cycles, the cpu is placed in the wait state until read operation has been completed. to continue the process after the data write to the device has been completed, perform a dummy read to the same address to check for completion of the write before the next process to be executed. the write buffer of the bsc functions in the same way for an access by the dtc. if the bsc register values are changed while the write buffer is in operation, correct access cannot be performed. therefore, do not change bsc regist er values immediately after a write access. if any bsc register setting needs to be modified immedi ately after a write access, dummy-read the write data and change the register value afte r making sure that the write access has ended.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 231 of 1080 rej09b0230-0300 9.5.8 access to on-chip flash and on-chip ram by cpu access to the on-chip flash for read is synchronized with i clock and is executed in one clock cycle. for details on programming and erasing, see section 20, flash memory. access to the on-chip ram for read/write is synchronized with i clock and is executed in one clock cycle. for details, see section 21, ram. 9.5.9 access to on-chip peripheral i/o registers by cpu table 9.10 shows the number of cycles required for access to the on-chip peripheral i/o registers by the cpu. table 9.10 number of cycles for acces s to on-chip peripheral i/o registers number of access cycles write (3 + n) i + (1 + m) b + 2 p read (3 + n) i + (1 + m) b + 2 p + 2 i notes: 1. when i :b = 8:1, n = 0 to 7. when i :b = 4:1, n = 0 to 3. when b :p = 4:1, m = 0 to 3. when i :b = 3:1, n = 0 to 2. when b :p = 3:1, m = 0 to 2. when i :b = 2:1, n = 0 to 1. when b :p = 2:1, m = 0 to 1. when i :b = 1:1, n = 0. when b :p = 1:1, m = 0. n and m depend on the internal execution state. 2. the clock ratio of mi and mp does not affect the number of access cycles.
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 232 of 1080 rej09b0230-0300 synchronous logic and a layered bus structure have been adopted for this lsi. data on each bus are input and output in synchronization with rising edges of the corresponding clock signal. the l bus, i bus, and peripheral bus are synchronized with the i , b , and p clock, respectively. figure 9.12 shows an example of the timing of write access to a register in 2p cycle access with the connected peripheral bus width of 16 bits when i :b :p = 4:2:2. in access to the on-chip peripheral i/o registers, the cp u requires three cycles of i for preparation of data transfer to the i bus after the data has been output to the l bus. afte r these three cycles, data can be transferred to the i bus in synchronization with rising edges of b . however, as there are two i clock cycles in a single b clock cycle when i : b = 4:2, transfer of data from the l bus to the i bus takes (3 + n) i (n = 0 to 1) (3 i is indicated in figure 9.12). the relation between the timing of data output to the l bus and the rising edge of b depends on the state of program execution. in the case shown in the figure, where n = 0 and m = 0, the time required for access is 3 i + 1 b + 2 p . i l bus b i bus p periipheral bus (3 + n) i (1 + m) b 2 p figure 9.12 timing of write access to on-chip peripheral i/o registers when i :b :p = 4:2:2 figure 9.13 shows an example of timing of read access to the peripheral bus when i :b :p = 4:2:1. transfer from the l bus to the peripheral bus is performed in the same way as for writing. in the case of reading, however, values output onto the peripheral bus need to be transferred to the cpu. although transfers from the peripheral bus to the i bus and from the i bus to the l bus are performed in synchronization with the rising edge of the respective bus clocks, a period of 2 i is actually required because i b p . in the case shown in the figure, where n = 0 and m = 1, the time required for access is 3 i + 2 b + 2 p + 2 i .
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 233 of 1080 rej09b0230-0300 i l bus b i bus p periipheral bus (3 + n) i (1 + m) b 2 i 2 p figure 9.13 timing of read access to on-chip peripheral i/o registers when i :b :p = 4:2:1
section 9 bus state controller (bsc) rev. 3.00 oct. 06, 2008 page 234 of 1080 rej09b0230-0300
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) timmtu1a_020020030800 rev. 3.00 oct. 06, 2008 page 235 of 1080 rej09b0230-0300 section 10 multi-function ti mer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) this lsi has an on-chip multi-function timer pulse unit 2 (mtu2) that comprises five 16-bit timer channels (channels 0 to 4), and an on-chip multi-function timer pulse unit 2s (mtu2s) that comprises three 16-bit timer channels (channels 3 to 5). the mtu2s can operate at maximum 80 mhz for complementary pwm output functions or at maximum 40 mhz for the other functions. the mtu2 can operate at maximum 40 mhz. to distinguish between the mtu2 function and the mtu2s function, "s" is added to the end of the mtu2s input/output pin and register names. for example, tioc3a is called tioc3as and tgra_3 is called tgra_3s in this section. since the functions of channels 3 and 4 are the same in mtu2 and mtu2s, the same names as for mtu2 functions are used for mtu2s functions; that is to say "s" is not added to the end of the mtu2s input/output pin and register names in section 10.3.1 or subsequent sections (in the description of the channel 5, "s" is not added.). 10.1 features ? maximum 16 pulse input/output lines in mtu2, and maximum six pulse input/output lines and three pulse input lines in mtu2s ? selection of six to eight counter input clocks for each channel (four clocks for channel 5) ? the following operations can be set for channels 0 to 4 in mtu2: ? waveform output at compare match ? input capture function ? counter clear operation ? multiple timer counters (tcnt) can be written to simultaneously ? simultaneous clearing by compare match and input capture is possible ? register simultaneous input/output is possible by synchronous counter operation ? a maximum 12-phase pwm output is possible in combination with synchronous operation (in mtu2s, a maximum 6-phase pwm output is possible in combination with channel 3 and channel 4 functions) ? buffer operation settable for channels 0, 3, and 4 ? phase counting mode settable independe ntly for each of channels 1 and 2 ? cascade connection operation ? fast access via internal 16-bit bus ? 25 interrupt sources in mtu2, and 13 interrupt sources in mtu2s ? automatic transfer of register data
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 236 of 1080 rej09b0230-0300 ? a/d converter start trigger can be generated ? module standby mode can be settable ? a total of six-phase waveform output, which includes complementary pwm output, and positive and negative phases of reset pwm output by interlocking operation of channels 3 and 4, is possible. ? ac synchronous motor (brushless dc motor) drive mode using complementary pwm output and reset pwm output is settable by interlocking operation of channels 0, 3, and 4, and the selection of two types of waveform outputs (chopping and level) is possible (mtu2 only). ? dead time compensation co unter available in channel 5 (mtu2s only) ? in complementary pwm mode, interrupts at the crest and trough of the counter value and a/d converter start triggers can be skipped.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 237 of 1080 rej09b0230-0300 table 10.1 mtu2 functions item channel 0 channel 1 channel 2 channel 3 channel 4 count clock mp /1 mp /4 mp /16 mp /64 tclka tclkb tclkc tclkd mp /1 mp /4 mp /16 mp /64 mp /256 tclka tclkb mp /1 mp /4 mp /16 mp /64 mp /1024 tclka tclkb tclkc mp /1 mp /4 mp /16 mp /64 mp /256 mp /1024 tclka tclkb mp /1 mp /4 mp /16 mp /64 mp /256 mp /1024 tclka tclkb general registers tgra_0 tgrb_0 tgre_0 tgra_1 tgrb_1 tgra_2 tgrb_2 tgra_3 tgrb_3 tgra_4 tgrb_4 general registers/ buffer registers tgrc_0 tgrd_0 tgrf_0 ? ? tgrc_3 tgrd_3 tgrc_4 tgrd_4 i/o pins tioc0a tioc0b tioc0c tioc0d tioc1a tioc1b tioc2a tioc2b tioc3a tioc3b tioc3c tioc3d tioc4a tioc4b tioc4c tioc4d counter clear function tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture 0 output 1 output compare match output toggle output input capture function synchronous operation pwm mode 1 pwm mode 2 ? ? complementary pwm mode ? ? ? reset pwm mode ? ? ? ac synchronous motor drive mode ? ?
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 238 of 1080 rej09b0230-0300 item channel 0 channel 1 channel 2 channel 3 channel 4 phase counting mode ? ? ? buffer operation ? ? dead time compensation counter function ? ? ? ? ? dtc activation tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture and tcnt overflow or underflow a/d converter start trigger tgra_0 compare match or input capture tgre_0 compare match tgra_1 compare match or input capture tgra_2 compare match or input capture tgra_3 compare match or input capture tgra_4 compare match or input capture tcnt_4 underflow (trough) in complementary pwm mode
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 239 of 1080 rej09b0230-0300 item channel 0 channel 1 channel 2 channel 3 channel 4 interrupt sources 7 sources ? compare match or input capture 0a ? compare match or input capture 0b ? compare match or input capture 0c ? compare match or input capture 0d ? compare match 0e ? compare match 0f ? overflow 4 sources ? compare match or input capture 1a ? compare match or input capture 1b ? overflow ? underflow 4 sources ? compare match or input capture 2a ? compare match or input capture 2b ? overflow ? underflow 5 sources ? compare match or input capture 3a ? compare match or input capture 3b ? compare match or input capture 3c ? compare match or input capture 3d ? overflow 5 sources ? compare match or input capture 4a ? compare match or input capture 4b ? compare match or input capture 4c ? compare match or input capture 4d ? overflow or underflow
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 240 of 1080 rej09b0230-0300 item channel 0 channel 1 channel 2 channel 3 channel 4 a/d converter start request delaying function ? ? ? ? ? a/d converter start request at a match between tadcora_4 and tcnt_4 ? a/d converter start request at a match between tadcorb_4 and tcnt_4 interrupt skipping function ? ? ? ? skips tgra_3 compare match interrupts ? skips tciv_4 interrupts [legend] : possible ?: not possible
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 241 of 1080 rej09b0230-0300 table 10.2 mtu2s functions item channel 3 channel 4 channel 5 count clock mi /1 mi /4 mi /16 mi /64 mi /256 mi /1024 mi /1 mi /4 mi /16 mi /64 mi /256 mi /1024 mi /1 mi /4 mi /16 mi /64 general registers tgra_3s tgrb_3s tgra_4s tgrb_4s tgru_5s tgrv_5s tgrw_5s general registers/ buffer registers tgrc_3s tgrd_3s tgrc_4s tgrd_4s ? i/o pins tioc3bs tioc3ds tioc4as tioc4bs tioc4cs tioc4ds input pins tic5us tic5vs tic5ws counter clear function tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture 0 output ? 1 output ? compare match output toggle output ? input capture function synchronous operation ? pwm mode 1 ? ? pwm mode 2 ? ? ? complementary pwm mode ? reset pwm mode ? ac synchronous motor drive mode ? ? ? phase counting mode ? ? ? buffer operation ?
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 242 of 1080 rej09b0230-0300 item channel 3 channel 4 channel 5 counter function of compensation for dead time ? ? dtc activation tgr compare match or input capture tgr compare match or input capture and tcnt overflow or underflow tgr compare match or input capture a/d converter start trigger tgra_3s compare match or input capture tgra_4s compare match or input capture tcnt_4s underflow (trough) in complementary pwm mode ? interrupt sources 5 sources ? compare match or input capture 3as ? compare match or input capture 3bs ? compare match or input capture 3cs ? compare match or input capture 3ds ? overflow 5 sources ? compare match or input capture 4as ? compare match or input capture 4bs ? compare match or input capture 4cs ? compare match or input capture 4ds ? overflow or underflow 3 sources ? compare match or input capture 5us ? compare match or input capture 5vs ? compare match or input capture 5ws a/d converter start request delaying function ? ? a/d converter start request at a match between tadcora_4s and tcnt_4s ? a/d converter start request at a match between tadcorb_4s and tcnt_4s ?
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 243 of 1080 rej09b0230-0300 item channel 3 channel 4 channel 5 interrupt skipping function ? skips tgra_3s compare match interrupts ? skips tciv_4s interrupts ? [legend] : possible ?: not possible
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 244 of 1080 rej09b0230-0300 figure 10.1 shows a block diagram of the mtu2. input/output pins channel 3: tioc3a tioc3b tioc3c tioc3d channel 4: tioc4a tioc4b tioc4c tioc4d interrupt request si g nals channel 3: tgia_3 tgib_3 tgic_3 tgid_3 tciv_3 channel 4: tgia_4 tgib_4 tgic_4 tgid_4 tciv_4 clock input internal clock: mp /1 mp /4 mp /16 mp /64 mp /256 mp /1024 external clock: tclka tclkb tclkc tclkd interrupt request si g nals channel 0: tgia_0 tgib_0 tgic_0 tgid_0 tgie_0 tgif_0 tciv_0 channel 1: tgia_1 tgib_1 tciv_1 tciu_1 channel 2: tgia_2 tgib_2 tciv_2 tciu_2 input/output pins channel 0: tioc0a tioc0b tioc0c tioc0d channel 1: tioc1a tioc1b channel 2: tioc2a tioc2b internal data bus tcnt tgra tgrb tgrc tgrd tmdr tcr tiorl tiorh tsr tier channel 3 tcnt tgra tgrb tgrc tgrd tmdr tcr tiorl tiorh tsr tier channel 4 tcnts tcbr tddr tcdr toer tocr tgcr bus i/f common tcnt tgra tgrb tmdr tcr tior tsr tier tsyr tstr channel 2 tcnt tgra tgrb tmdr tcr tior tsr tier channel 1 tcnt tgra tgrb tgrc tgrd tgre tgrf tmdr tcr tiorl tiorh tsr tier channel 0 control lo g ic module data bus control lo g ic for channels 0 to 2 control lo g ic for channels 3 and 4 [le g end] tstr: timer start re g ister tsyr: timer synchronous re g ister tcr: timer control re g ister tmdr: timer mode re g ister tior: timer i/o control re g ister tiorh: timer i/o control re g ister h tiorl: timer i/o control re g ister l tier: timer interrupt enable re g ister tgcr: timer g ate control re g ister toer: timer output master enable re g ister tocr: timer output control re g ister tsr: timer status re g ister tcnt: timer counter tcnts: timer subcounter tcdr: timer cycle data re g ister tcbr: timer cycle buffer re g ister tddr: timer dead time data re g ister tgra: timer g eneral re g ister a tgrb: timer g eneral re g ister b tgrc: timer g eneral re g ister c tgrd: timer g eneral re g ister d tgre: timer g eneral re g ister e tgrf: timer g eneral re g ister f a/d conversion start si g nals channels 0 to 4: trgan channel 0: trg0n channel 4: trg4an trg4bn figure 10.1 block diagram of mtu2
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 245 of 1080 rej09b0230-0300 figure 10.2 shows a block diagram of the mtu2s. input/output pins channel 3: tioc3a tioc3b tioc3c tioc3d channel 4: tioc4a tioc4b tioc4c tioc4d input pins channel 5: tic5u tic5v tic5w interrupt request si g nals channel 3: tgia_3 tgib_3 tgic_3 tgid_3 tciv_3 channel 4: tgia_4 tgib_4 tgic_4 tgid_4 tciv_4 channel 5: tgiu_5 tgiv_5 tgiw_5 clock input internal clock: mp /1 mp /4 mp /16 mp /64 mp /256 mp /1024 internal data bus a/d converter conversion start si g nal tcnt_3s tgra_3s tgrb_3s tgrc_3s tgrd_3s tmdr_3s tcr_3s tiorl_3s tiorh_3s tsr_3s tier_3s channel 3 tcnt_4s tgra_4s tgrb_4s tgrc_4s tgrd_4s tmdr_4s tcr_4s tiorl_4s tiorh_4s tsr_4s tier_4s channel 4 tcntss tcbrs tddrs tcdrs toers tocrs tgcrs bus i/f common tsyrs tstrs tcntu_5s tgru_5s tcntv_5s tgrv_5s tcntw_5s tgrw_5s tcr_5s tior_5s tier_5s tsr_5s channel 5 control lo g ic module data bus control lo g ic for channels 3 and 4 [le g end] tstrs: timer start re g ister s tsyrs: timer synchronous re g ister s tcr: timer control re g ister tmdr: timer mode re g ister tior: timer i/o control re g ister tiorh: timer i/o control re g ister h tiorl: timer i/o control re g ister l tier: timer interrupt enable re g ister tgcrs: timer g ate control re g ister s toers: timer output master enable re g ister s tocrs: timer output control re g ister s tsr: timer status re g ister tcnt: timer counter tcntss: timer subcounter s tcdrs: timer cycle data re g ister s tcbrs: timer cycle buffer re g ister s tddrs: timer dead time data re g ister s tgra: timer g eneral re g ister a tgrb: timer g eneral re g ister b tgrc: timer g eneral re g ister c tgrd: timer g eneral re g ister d tgru: timer g eneral re g ister u tgrv: timer g eneral re g ister v tgrw: timer g eneral re g ister w figure 10.2 block diagram of mtu2s
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 246 of 1080 rej09b0230-0300 10.2 input/output pins table 10.3 mtu2 pin configuration channel pin name i/o function common tclka input external clock a input pin (channel 1 phase counting mode a phase input) tclkb input external clock b input pin (channel 1 phase counting mode b phase input) tclkc input external clock c input pin (channel 2 phase counting mode a phase input) tclkd input external clock d input pin (channel 2 phase counting mode b phase input) 0 tioc0a i/o tgra_0 input capture input/output compare output/pwm output pin tioc0b i/o tgrb_0 input capture input/output compare output/pwm output pin tioc0c i/o tgrc_0 input capture input/output compare output/pwm output pin tioc0d i/o tgrd_0 input capture input/output compare output/pwm output pin 1 tioc1a i/o tgra_1 input capture input/output compare output/pwm output pin tioc1b i/o tgrb_1 input capture input/output compare output/pwm output pin 2 tioc2a i/o tgra_2 input capture input/output compare output/pwm output pin tioc2b i/o tgrb_2 input capture input/output compare output/pwm output pin 3 tioc3a i/o tgra_3 input capture input/output compare output/pwm output pin tioc3b i/o tgrb_3 input capture input/output compare output/pwm output pin tioc3c i/o tgrc_3 input capture input/output compare output/pwm output pin tioc3d i/o tgrd_3 input capture input/output compare output/pwm output pin 4 tioc4a i/o tgra_4 input capture input/output compare output/pwm output pin tioc4b i/o tgrb_4 input capture input/output compare output/pwm output pin tioc4c i/o tgrc_4 input capture input/output compare output/pwm output pin tioc4d i/o tgrd_4 input capture input/output compare output/pwm output pin
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 247 of 1080 rej09b0230-0300 table 10.4 mtu2s pin configuration channel symbol i/o function 3 tioc3bs i/o tgrb_3s input capture input/output compare output/pwm output pin tioc3ds i/o tgrd_3s input capture input/output compare output/pwm output pin 4 tioc4as i/o tgra_4s input capture input/output compare output/pwm output pin tioc4bs i/o tgrb_4s input capture input/output compare output/pwm output pin tioc4cs i/o tgrc_4s input capture input/output compare output/pwm output pin tioc4ds i/o tgrd_4s input capture input/output compare output/pwm output pin 5 tic5us input tgru_5s input capture input/external pulse input pin tic5vs input tgrv_5s input capture input/external pulse input pin tic5ws input tgrw_5s input capture input/external pulse input pin
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 248 of 1080 rej09b0230-0300 10.3 register descriptions the mtu2 and mtu2s have the following registers. for details on register addresses and register states during each process, refer to section 24, list of registers. to distinguish registers in each channel, an underscore and the channel number ar e added as a suffix to the register name; tcr for channel 0 in the mtu2 is expressed as tcr_0. table 10.5 mtu2 register configuration register name abbrevia- tion r/w initial value address access size timer control register_3 tcr_3 r/w h'00 h'ffffc200 8, 16, 32 timer control register_4 tcr_4 r/w h'00 h'ffffc201 8 timer mode register_3 tmdr_3 r/w h'00 h'ffffc202 8, 16 timer mode register_4 tmdr_4 r/w h'00 h'ffffc203 8 timer i/o control register h_3 tiorh_3 r/w h'00 h'ffffc204 8, 16, 32 timer i/o control register l_3 tiorl_3 r/w h'00 h'ffffc205 8 timer i/o control register h_4 tiorh_4 r/w h'00 h'ffffc206 8, 16 timer i/o control register l_4 tiorl_4 r/w h'00 h'ffffc207 8 timer interrupt enable register_3 tier_3 r/w h'00 h'ffffc208 8, 16 timer interrupt enable register_4 tier_4 r/w h'00 h'ffffc209 8 timer output master enable register toer r/w h'c0 h'ffffc20a 8 timer gate control register tgcr r/w h'80 h'ffffc20d 8 timer output control register 1 tocr1 r/w h'00 h'ffffc20e 8, 16 timer output control register 2 tocr2 r/w h'00 h'ffffc20f 8 timer counter_3 tcnt_3 r/w h'0000 h'ffffc210 16, 32 timer counter_4 tcnt_4 r/w h'0000 h'ffffc212 16 timer cycle data register tcdr r/w h'ffff h'ffffc214 16, 32 timer dead time data register tddr r/w h'ffff h'ffffc216 16 timer general register a_3 tgra_3 r/w h'ffff h'ffffc218 16, 32 timer general register b_3 tgrb_3 r/w h'ffff h'ffffc21a 16 timer general register a_4 tgra_4 r/w h'ffff h'ffffc21c 16, 32 timer general register b_4 tgrb_4 r/w h'ffff h'ffffc21e 16
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 249 of 1080 rej09b0230-0300 register name abbrevia- tion r/w initial value address access size timer subcounter tcnts r h'0000 h'ffffc220 16, 32 timer cycle buffer register tcbr r/w h'ffff h'ffffc222 16 timer general register c_3 tgrc_3 r/w h'ffff h'ffffc224 16, 32 timer general register d_3 tgrd_3 r/w h'ffff h'ffffc226 16 timer general register c_4 tgrc_4 r/w h'ffff h'ffffc228 16, 32 timer general register d_4 tgrd_4 r/w h'ffff h'ffffc22a 16 timer status register_3 tsr_3 r/w h'c0 h'ffffc22c 8, 16 timer status register_4 tsr_4 r/w h'c0 h'ffffc22d 8 timer interrupt skipping set register titcr r/w h'00 h'ffffc230 8, 16 timer interrupt skipping counter titcnt r h'00 h'ffffc231 8 timer buffer transfer set register tbter r/w h'00 h'ffffc232 8 timer dead time enable register tder r/w h'01 h'ffffc234 8 timer output level buffer register tolbr r/w h'00 h'ffffc236 8 timer buffer operation transfer mode register_3 tbtm_3 r/w h'00 h'ffffc238 8, 16 timer buffer operation transfer mode register_4 tbtm_4 r/w h'00 h'ffffc239 8 timer a/d converter start request control register tadcr r/w h'0000 h'ffffc240 16 timer a/d converter start request cycle set register a_4 tadcora_4 r/w h'ffff h'ffffc244 16, 32 timer a/d converter start request cycle set register b_4 tadcorb_4 r/w h'ffff h'ffffc246 16 timer a/d converter start request cycle set buffer register a_4 tadcobra_4 r/w h'ffff h'ffffc248 16, 32 timer a/d converter start request cycle set buffer register b_4 tadcobrb_4 r/w h'ffff h'ffffc24a 16
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 250 of 1080 rej09b0230-0300 register name abbrevia- tion r/w initial value address access size timer waveform control register twcr r/w h'00 h'ffffc260 8 timer start register tstr r/w h'00 h'ffffc280 8, 16 timer synchronous register tsyr r/w h'00 h'ffffc281 8 timer counter synchronous start register tcsystr r/w h'00 h'ffffc282 8 timer read/write enable register trwer r/w h'01 h'ffffc284 8 timer control register_0 tcr_0 r/w h'00 h'ffffc300 8, 16, 32 timer mode register_0 tmdr_0 r/w h'00 h'ffffc301 8 timer i/o control register h_0 tiorh_0 r/w h'00 h'ffffc302 8, 16 timer i/o control register l_0 tiorl_0 r/w h'00 h'ffffc303 8 timer interrupt enable register_0 tier_0 r/w h'00 h'ffffc304 8, 16, 32 timer status register_0 tsr_0 r/w h'c0 h'ffffc305 8 timer counter_0 tcnt_0 r/w h'0000 h'ffffc306 16 timer general register a_0 tgra_0 r/w h'ffff h'ffffc308 16, 32 timer general register b_0 tgrb_0 r/w h'ffff h'ffffc30a 16 timer general register c_0 tgrc_0 r/w h'ffff h'ffffc30c 16, 32 timer general register d_0 tgrd_0 r/w h'ffff h'ffffc30e 16 timer general register e_0 tgre_0 r/w h'ffff h'ffffc320 16, 32 timer general register f_0 tgrf_0 r/w h'ffff h'ffffc322 16 timer interrupt enable register 2_0 tier2_0 r/w h'00 h'ffffc324 8, 16 timer status register 2_0 tsr2_0 r/w h'c0 h'ffffc325 8 timer buffer operation transfer mode register_0 tbtm_0 r/w h'00 h'ffffc326 8 timer control register_1 tcr_1 r/w h'00 h'ffffc380 8, 16 timer mode register_1 tmdr_1 r/w h'00 h'ffffc381 8 timer i/o control register _1 tior_1 r/w h'00 h'ffffc382 8 timer interrupt enable register_1 tier_1 r/w h'00 h'ffffc384 8, 16, 32 timer status register_1 tsr_1 r/w h'c0 h'ffffc385 8
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 251 of 1080 rej09b0230-0300 register name abbrevia- tion r/w initial value address access size timer counter_1 tcnt_1 r/w h'0000 h'ffffc386 16 timer general register a_1 tgra_1 r/w h'ffff h'ffffc388 16, 32 timer general register b_1 tgrb_1 r/w h'ffff h'ffffc38a 16 timer input capture control register ticcr r/w h'00 h'ffffc390 8 timer control register_2 tcr_2 r/w h'00 h'ffffc400 8, 16 timer mode register_2 tmdr_2 r/w h'00 h'ffffc401 8 timer i/o control register_2 tior_2 r/w h'00 h'ffffc402 8 timer interrupt enable register_2 tier_2 r/w h'00 h'ffffc404 8, 16, 32 timer status register_2 tsr_2 r/w h'c0 h'ffffc405 8 timer counter_2 tcnt_2 r/w h'0000 h'ffffc406 16 timer general register a_2 tgra_2 r/w h'ffff h'ffffc408 16, 32 timer general register b_2 tgrb_2 r/w h'ffff h'ffffc40a 16
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 252 of 1080 rej09b0230-0300 table 10.6 mtu2s register configuration register name abbrevia- tion r/w initial value address access size timer control register_3s tcr_3s r/w h'00 h'ffffc600 8, 16, 32 timer control register_4s tcr_4s r/w h'00 h'ffffc601 8 timer mode register_3s tmdr_3s r/w h'00 h'ffffc602 8, 16 timer mode register_4s tmdr_4s r/w h'00 h'ffffc603 8 timer i/o control register h_3s tiorh_3s r/w h'00 h'ffffc604 8, 16, 32 timer i/o control register l_3s tiorl_3s r/w h'00 h'ffffc605 8 timer i/o control register h_4s tiorh_4s r/w h'00 h'ffffc606 8, 16 timer i/o control register l_4s tiorl_4s r/w h'00 h'ffffc607 8 timer interrupt enable register_3s tier_3s r/w h'00 h'ffffc608 8, 16 timer interrupt enable register_4s tier_4s r/w h'00 h'ffffc609 8 timer output master enable register s toers r/w h'c0 h'ffffc60a 8 timer gate control register s tgcrs r/w h'80 h'ffffc60d 8 timer output control register 1s tocr1s r/w h'00 h'ffffc60e 8, 16 timer output control register 2s tocr2s r/w h'00 h'ffffc60f 8 timer counter_3s tcnt_3s r/w h'0000 h'ffffc610 16, 32 timer counter_4s tcnt_4s r/w h'0000 h'ffffc612 16 timer cycle data register s tcdrs r/w h'ffff h'ffffc614 16, 32 timer dead time data register s tddrs r/w h'ffff h'ffffc616 16 timer general register a_3s tgra_3s r/w h'ffff h'ffffc618 16, 32 timer general register b_3s tgrb_3s r/w h'ffff h'ffffc61a 16 timer general register a_4s tgra_4s r/w h'ffff h'ffffc61c 16, 32 timer general register b_4s tgrb_4s r/w h'ffff h'ffffc61e 16 timer subcounter s tcntss r h'0000 h'ffffc620 16, 32 timer cycle buffer register s tcbrs r/w h'ffff h'ffffc622 16 timer general register c_3s tgrc_3s r/w h'ffff h'ffffc624 16, 32 timer general register d_3s tgrd_3s r/w h'ffff h'ffffc626 16
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 253 of 1080 rej09b0230-0300 register name abbrevia- tion r/w initial value address access size timer general register c_4s tgrc_4s r/w h'ffff h'ffffc628 16, 32 timer general register d_4s tgrd_4s r/w h'ffff h'ffffc62a 16 timer status register_3s tsr_3s r/w h'c0 h'ffffc62c 8, 16 timer status register_4s tsr_4s r/w h'c0 h'ffffc62d 8 timer interrupt skipping set register s titcrs r/w h'00 h'ffffc630 8, 16 timer interrupt skipping counter s titcnts r h'00 h'ffffc631 8 timer buffer transfer set register s tbters r/w h'00 h'ffffc632 8 timer dead time enable register s tders r/w h'01 h'ffffc634 8 timer output level buffer register s tolbrs r/w h'00 h'ffffc636 8 timer buffer operation transfer mode register_3s tbtm_3s r/w h'00 h'ffffc638 8, 16 timer buffer operation transfer mode register_4s tbtm_4s r/w h'00 h'ffffc639 8 timer a/d converter start request control register s tadcrs r/w h'0000 h'ffffc640 16 timer a/d converter start request cycle set register a_4s tadcora_4s r/w h'ffff h'ffffc644 16, 32 timer a/d converter start request cycle set register b_4s tadcorb_4s r/w h'ffff h'ffffc646 16 timer a/d converter start request cycle set buffer register a_4s tadcobra_4s r/w h'ffff h'ffffc648 16, 32 timer a/d converter start request cycle set buffer register b_4s tadcobrb_4s r/w h'ffff h'ffffc64a 16 timer synchronous clear register s tsycrs r/w h'00 h'ffffc650 8 timer waveform control register s twcrs r/w h'00 h'ffffc660 8 timer start register s tstrs r/w h'00 h'ffffc680 8, 16
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 254 of 1080 rej09b0230-0300 register name abbrevia- tion r/w initial value address access size timer synchronous register s tsyrs r/w h'00 h'ffffc681 8 timer read/write enable register s trwers r/w h'01 h'ffffc684 8 timer counter u_5s tcntu_5s r/w h'0000 h'ffffc880 16, 32 timer general register u_5s tgru_5s r/w h'ffff h'ffffc882 16 timer control register u_5s tcru_5s r/w h'00 h'ffffc884 8 timer i/o control register u_5s tioru_5s r/w h'00 h'ffffc886 8 timer counter v_5s tcntv_5s r/w h'0000 h'ffffc890 16, 32 timer general register v_5s tgrv_5s r/w h'ffff h'ffffc892 16 timer control register v_5s tcrv_5s r/w h'00 h'ffffc894 8 timer i/o control register v_5s tiorv_5s r/w h'00 h'ffffc896 8 timer counter w_5s tcntw_5s r/w h'0000 h'ffffc8a0 16, 32 timer general register w_5s tgrw_5s r/w h'ffff h'ffffc8a2 16 timer control register w_5s tcrw_5s r/w h'00 h'ffffc8a4 8 timer i/o control register w_5s tiorw_5s r/w h'00 h'ffffc8a6 8 timer status register_5s tsr_5s r/w h'00 h'ffffc8b0 8 timer interrupt enable register_5s tier_5s r/w h'00 h'ffffc8b2 8 timer start register_5s ts tr_5s r/w h'00 h'ffffc8b4 8 timer compare match clear register s tcntcmpclrs r/w h'00 h'ffffc8b6 8
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 255 of 1080 rej09b0230-0300 10.3.1 timer control register (tcr) the tcr registers are 8-bit readab le/writable registers that cont rol the tcnt operation for each channel. the mtu2 has a total of eight tcr registers, one each for channels 0 to 4 and three (tcru_5, tcrv_5, and tcrw_5) for channel 5. tcr register settings should be conducted only when tcnt operation is stopped. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w cclr[2:0] ckeg[1:0] tpsc[2:0] bit bit name initial value r/w description 7 to 5 cclr[2:0] 000 r/w counter clear 0 to 2 these bits select the tcnt counter clearing source. see tables 10.7 and 10.8 for details. 4, 3 ckeg[1:0] 00 r/w clock edge 0 and 1 these bits select the input clock edge. when the input clock is counted using both edges, the input clock period is halved (e.g. mp /4 both edges = mp /2 rising edge). if phase counting mode is used on channels 1 and 2, this setting is ignored and the phase counting mode setting has priority. internal clock edge selection is valid when the input clock is mp /4 or slower. when mp /1, or the overflow/underflow of another channel is selected for the input clock, although values can be written, counter operation compiles with the initial value. 00: count at rising edge 01: count at falling edge 1x: count at both edges 2 to 0 tpsc[2:0] 000 r/w time prescaler 0 to 2 these bits select the tcnt counter clock. the clock source can be selected independently for each channel. see tables 10.9 to 10.13 for details. [legend] x: don't care
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 256 of 1080 rej09b0230-0300 table 10.7 cclr0 to cclr2 (channels 0, 3, and 4) channel bit 7 cclr2 bit 6 cclr1 bit 5 cclr0 description 0, 3, 4 0 0 0 tcnt clearing disabled 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 1 0 0 tcnt clearing disabled 1 tcnt cleared by tgrc compare match/input capture * 2 1 0 tcnt cleared by tgrd compare match/input capture * 2 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 notes: 1. synchronous operation is set by setting the sync bit in tsyr to 1. 2. when tgrc or tgrd is used as a buffer register, tcnt is not cleared because the buffer register setting has priority, and compare match/input capture does not occur. table 10.8 cclr0 to cclr2 (channels 1 and 2) channel bit 7 reserved * 2 bit 6 cclr1 bit 5 cclr0 description 1, 2 0 0 0 tcnt clearing disabled 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 notes: 1. synchronous operation is selected by setting the sync bit in tsyr to 1. 2. bit 7 is reserved in channels 1 and 2. it is always read as 0 and cannot be modified.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 257 of 1080 rej09b0230-0300 table 10.9 tpsc0 to tpsc2 (channel 0) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 0 0 0 0 internal clock: counts on mp /1 1 internal clock: counts on mp /4 1 0 internal clock: counts on mp /16 1 internal clock: counts on mp /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 external clock: counts on tclkd pin input table 10.10 tpsc0 to tpsc2 (channel 1) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 1 0 0 0 internal clock: counts on mp /1 1 internal clock: counts on mp /4 1 0 internal clock: counts on mp /16 1 internal clock: counts on mp /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 internal clock: counts on mp /256 1 counts on tcnt_2 overflow/underflow note: this setting is ignored when channel 1 is in phase counting mode.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 258 of 1080 rej09b0230-0300 table 10.11 tpsc0 to tpsc2 (channel 2) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 2 0 0 0 internal clock: counts on mp /1 1 internal clock: counts on mp /4 1 0 internal clock: counts on mp /16 1 internal clock: counts on mp /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 internal clock: counts on mp /1024 note: this setting is ignored when channel 2 is in phase counting mode. table 10.12 tpsc0 to tpsc2 (channels 3 and 4) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 3, 4 0 0 0 internal clock: counts on mp /1 1 internal clock: counts on mp /4 1 0 internal clock: counts on mp /16 1 internal clock: counts on mp /64 1 0 0 internal clock: counts on mp /256 1 internal clock: counts on mp /1024 1 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 259 of 1080 rej09b0230-0300 table 10.13 tpsc1 and tpsc0 (channel 5) channel bit 1 tpsc1 bit 0 tpsc0 description 5 0 0 internal clock: counts on mp /1 1 internal clock: counts on mp /4 1 0 internal clock: counts on mp /16 1 internal clock: counts on mp /64 note: bits 7 to 2 are reserved in channel 5. these bits are always read as 0. the write value should always be 0. 10.3.2 timer mode register (tmdr) the tmdr registers are 8-bit readab le/writable registers that are used to set the operating mode of each channel. the mtu2 has five tmdr registers, one each for channels 0 to 4. tmdr register settings should be changed only when tcnt operation is stopped. bit: initial value: r/w: 7654321 0 00000000 - r/w r/w r/w r/w r/w r/w r/w - bfe bfb bfa md[3:0] bit bit name initial value r/w description 7 ? 0 ? reserved this bit is always read as 0. the write value should always be 0. 6 bfe 0 r/w buffer operation e specifies whether tgre_0 and tgrf_0 are to operate in the normal way or to be used together for buffer operation. compare match with tgrf occurs even when tgrf is used as a buffer register. in channels 1 to 4, this bit is reserved. it is always read as 0 and the write value should always be 0. 0: tgre_0 and tgrf_0 operate normally 1: tgre_0 and tgrf_0 used together for buffer operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 260 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 bfb 0 r/w buffer operation b specifies whether tgrb is to operate in the normal way, or tgrb and tgrd are to be used together for buffer operation. when tgrd is used as a buffer register, tgrd input capture/output compare do not take place in modes other than complementary pwm mode, but compare match with tgrd occurs in complementary pwm mode. since the tgfd flag will be set if a compare match occurs during tb interval in complementary pwm mode, the tgied bit in timer interrupt enable register 3/4 (tier_3/4) should be cleared to 0. in channels 1 and 2, which have no tgrd, bit 5 is reserved. it is always read as 0 and cannot be modified. 0: tgrb and tgrd operate normally 1: tgrb and tgrd used together for buffer operation 4 bfa 0 r/w buffer operation a specifies whether tgra is to operate in the normal way, or tgra and tgrc are to be used together for buffer operation. when tgrc is used as a buffer register, tgrc input capture/output compare do not take place in modes other than complementary pwm mode, but compare match with tgrc occurs in complementary pwm mode. since the tgfc flag will be set if a compare match occurs on channel 4 during tb interval in complementary pwm mode, the tgiec bit in timer interrupt enable register 4 (tier_4) should be cleared to 0. in channels 1 and 2, which have no tgrc, bit 4 is reserved. it is always read as 0 and cannot be modified. 0: tgra and tgrc operate normally 1: tgra and tgrc used together for buffer operation 3 to 0 md[3:0] 0000 r/w modes 0 to 3 these bits are used to set the timer operating mode. see table 10.14 for details.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 261 of 1080 rej09b0230-0300 table 10.14 setting of operation mode by bits md0 to md3 bit 3 md3 bit 2 md2 bit 1 md1 bit 0 md0 description 0 0 0 0 normal operation 1 setting prohibited 1 0 pwm mode 1 1 pwm mode 2 * 1 1 0 0 phase counting mode 1 * 2 1 phase counting mode 2 * 2 1 0 phase counting mode 3 * 2 1 phase counting mode 4 * 2 1 0 0 0 reset synchronous pwm mode * 3 1 setting prohibited 1 x setting prohibited 1 0 0 setting prohibited 1 complementary pwm mode 1 (transmit at crest) * 3 1 0 complementary pwm mode 2 (transmit at trough) * 3 1 complementary pwm mode 2 (transmit at crest and trough) * 3 [legend] x: don't care notes: 1. pwm mode 2 cannot be set for channels 3 and 4. 2. phase counting mode cannot be set for channels 0, 3, and 4. 3. reset synchronous pwm mode and complementary pwm mode can only be set for channel 3. when channel 3 is set to reset synchronous pwm mode or complementary pwm mode, the channel 4 settings become ineffective and automatically conform to the channel 3 settings. however, do not set channel 4 to reset synchronous pwm mode or complementary pwm mode. reset synchronous pwm mode and complementary pwm mode cannot be set for channels 0, 1, and 2.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 262 of 1080 rej09b0230-0300 10.3.3 timer i/o control register (tior) the tior registers are 8-bit read able/writable registers that control the tgr registers. the mtu2 has a total of eleven tior registers, two each for channels 0, 3, and 4, one each for channels 1 and 2, and three (tioru_5, tiorv_5, and tiorw_5) for channel 5. tior should be set when tmdr is set to select normal operation, pwm mode, or phase counting mode. the initial output specified by tior is valid when the counter is stopped (the cst bit in tstr is cleared to 0). note also that, in pwm mode 2, the output at the point at which the counter is cleared to 0 is specified. when tgrc or tgrd is designated for buffer operation, this setting is invalid and the register operates as a buffer register. ? tiorh_0, tior_1, tior_2, tiorh_3, tiorh_4 bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w iob[3:0] ioa[3:0] bit bit name initial value r/w description 7 to 4 iob[3:0] 0000 r/w i/o control b0 to b3 specify the function of tgrb. see the following tables. tiorh_0: table 10.15 tior_1: table 10.17 tior_2: table 10.18 tiorh_3: table 10.19 tiorh_4: table 10.21 3 to 0 ioa[3:0] 0000 r/w i/o control a0 to a3 specify the function of tgra. see the following tables. tiorh_0: table 10.23 tior_1: table 10.25 tior_2: table 10.26 tiorh_3: table 10.27 tiorh_4: table 10.29
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 263 of 1080 rej09b0230-0300 ? tiorl_0, tiorl_3, tiorl_4 bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w iod[3:0] ioc[3:0] bit bit name initial value r/w description 7 to 4 iod[3:0] 0000 r/w i/o control d0 to d3 specify the function of tgrd. see the following tables. tiorl_0: table 10.16 tiorl_3: table 10.20 tiorl_4: table 10.22 3 to 0 ioc[3:0] 0000 r/w i/o control c0 to c3 specify the function of tgrc. see the following tables. tiorl_0: table 10.24 tiorl_3: table 10.28 tiorl_4: table 10.30 ? tioru_5, tiorv_5, tiorw_5 bit: initial value: r/w: 7654321 0 00000000 r r r r/w r/w r/w r/w r/w - - - ioc[4:0] bit bit name initial value r/w description 7 to 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 4 to 0 ioc[4:0] 00000 r/w i/o control c0 to c4 specify the function of tgru_5, tgrv_5, and tgrw_5. for details, see table 10.31.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 264 of 1080 rej09b0230-0300 table 10.15 tiorh_0 (channel 0) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_0 function tioc0b pin function 0 output retained * 0 1 initial output is 0 0 output at compare match 0 initial output is 0 1 output at compare match 0 1 1 initial output is 0 toggle output at compare match 0 0 output retained 1 initial output is 1 0 output at compare match 0 initial output is 1 1 output at compare match 0 1 1 1 output compare register initial output is 1 toggle output at compare match 0 input capture at rising edge 0 1 input capture at falling edge 1 0 1 x input capture register input capture at both edges 1 x x capture input source is channel 1/count clock input capture at tcnt_1 count-up/count-down [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 265 of 1080 rej09b0230-0300 table 10.16 tiorl_0 (channel 0) description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_0 function tioc0d pin function 0 0 0 0 output retained * 1 1 initial output is 0 0 output at compare match 1 0 output compare register * 2 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register * 2 input capture at both edges 1 x x capture input source is channel 1/count clock input capture at tcnt_1 count-up/count-down [legend] x: don't care notes: 1. after power-on reset, 0 is output until tior is set. 2. when the bfb bit in tmdr_0 is set to 1 and tgrd_0 is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 266 of 1080 rej09b0230-0300 table 10.17 tior_1 (channel 1) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_1 function tioc1b pin function 0 0 0 0 output retained * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges 1 x x input capture at generation of tgrc_0 compare match/input capture [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 267 of 1080 rej09b0230-0300 table 10.18 tior_2 (channel 2) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_2 function tioc2b pin function 0 0 0 0 output retained * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register input capture at falling edge 1 x input capture at both edges [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 268 of 1080 rej09b0230-0300 table 10.19 tiorh_3 (channel 3) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_3 function tioc3b pin function 0 0 0 0 output retained * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register input capture at falling edge 1 x input capture at both edges [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 269 of 1080 rej09b0230-0300 table 10.20 tiorl_3 (channel 3) description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_3 function tioc3d pin function 0 0 0 0 output retained * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register * 2 input capture at falling edge 1 x input capture at both edges [legend] x: don't care notes: 1. after power-on reset, 0 is output until tior is set. 2. when the bfb bit in tmdr_3 is set to 1 and tgrd_3 is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 270 of 1080 rej09b0230-0300 table 10.21 tiorh_4 (channel 4) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_4 function tioc4b pin function 0 0 0 0 output retained * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register input capture at falling edge 1 x input capture at both edges [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 271 of 1080 rej09b0230-0300 table 10.22 tiorl_4 (channel 4) description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_4 function tioc4d pin function 0 0 0 0 output retained * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register * 2 input capture at falling edge 1 x input capture at both edges [legend] x: don't care notes: 1. after power-on reset, 0 is output until tior is set. 2. when the bfb bit in tmdr_4 is set to 1 and tgrd_4 is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 272 of 1080 rej09b0230-0300 table 10.23 tiorh_0 (channel 0) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_0 function tioc0a pin function 0 0 0 0 output retained * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges 1 x x capture input source is channel 1/count clock input capture at tcnt_1 count-up/count-down [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 273 of 1080 rej09b0230-0300 table 10.24 tiorl_0 (channel 0) description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_0 function tioc0c pin function 0 0 0 0 output retained * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register * 2 input capture at both edges 1 x x capture input source is channel 1/count clock input capture at tcnt_1 count-up/count-down [legend] x: don't care notes: 1. after power-on reset, 0 is output until tior is set. 2. when the bfa bit in tmdr_0 is set to 1 and tgrc_0 is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 274 of 1080 rej09b0230-0300 table 10.25 tior_1 (channel 1) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_1 function tioc1a pin function 0 0 0 0 output retained * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges 1 x x input capture at generation of channel 0/tgra_0 compare match/input capture [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 275 of 1080 rej09b0230-0300 table 10.26 tior_2 (channel 2) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_2 function tioc2a pin function 0 0 0 0 output retained * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register input capture at falling edge 1 x input capture at both edges [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 276 of 1080 rej09b0230-0300 table 10.27 tiorh_3 (channel 3) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_3 function tioc3a pin function 0 0 0 0 output retained * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register input capture at falling edge 1 x input capture at both edges [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 277 of 1080 rej09b0230-0300 table 10.28 tiorl_3 (channel 3) description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_3 function tioc3c pin function 0 0 0 0 output retained * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register * 2 input capture at falling edge 1 x input capture at both edges [legend] x: don't care notes: 1. after power-on reset, 0 is output until tior is set. 2. when the bfa bit in tmdr_3 is set to 1 and tgrc_3 is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 278 of 1080 rej09b0230-0300 table 10.29 tiorh_4 (channel 4) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_4 function tioc4a pin function 0 0 0 0 output retained * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register input capture at falling edge 1 x input capture at both edges [legend] x: don't care note: * after power-on reset, 0 is output until tior is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 279 of 1080 rej09b0230-0300 table 10.30 tiorl_4 (channel 4) description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_4 function tioc4c pin function 0 0 0 0 output retained * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output retained 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture register * 2 input capture at falling edge 1 x input capture at both edges [legend] x: don't care notes: 1. after power-on reset, 0 is output until tior is set. 2. when the bfa bit in tmdr_4 is set to 1 and tgrc_4 is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 280 of 1080 rej09b0230-0300 table 10.31 tioru_5, tiorv_5, and tiorw_5 (channel 5) description bit 4 ioc4 bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgru_5, tgrv_5, and tgrw_5 function tic5u, tic5v, and tic5w pin function 0 0 0 0 0 compare match 1 setting prohibited 1 x setting prohibited 1 x x setting prohibited 1 x x x compare match register setting prohibited 1 0 0 0 0 setting prohibited 1 input capture at rising edge 1 0 input capture at falling edge 1 input capture at both edges 1 x x setting prohibited 1 0 0 0 setting prohibited 1 measurement of low pulse width of external input signal capture at trough of complementary pwm mode 1 0 measurement of low pulse width of external input signal capture at crest of complementary pwm mode 1 measurement of low pulse width of external input signal capture at crest and trough of complementary pwm mode 1 0 0 setting prohibited 1 measurement of high pulse width of external input signal capture at trough of complementary pwm mode 1 0 input capture register measurement of high pulse width of external input signal capture at crest of complementary pwm mode 1 measurement of high pulse width of external input signal capture at crest and trough of complementary pwm mode [legend] x: don't care
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 281 of 1080 rej09b0230-0300 10.3.4 timer compare match clear register (tcntcmpclr) tcntcmpclr is an 8-bit readable/writable regist er that specifies requests to clear tcntu_5, tcntv_5, and tcntw_5. the mtu2 has one tcntcmpclr in channel 5. bit: initial value: r/w: 7654321 0 00000000 r r r r r r/w r/w r/w ----- cmp clr5u cmp clr5v cmp clr5w bit bit name initial value r/w description 7 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 cmpclr5u 0 r/w tcnt compare clear 5u enables or disables requests to clear tcntu_5 at tgru_5 compare match or input capture. 0: disables tcntu_5 to be cleared to h'0000 at tcntu_5 and tgru_5 compare match or input capture 1: enables tcntu_5 to be cleared to h'0000 at tcntu_5 and tgru_5 compare match or input capture 1 cmpclr5v 0 r/w tcnt compare clear 5v enables or disables requests to clear tcntv_5 at tgrv_5 compare match or input capture. 0: disables tcntv_5 to be cleared to h'0000 at tcntv_5 and tgrv_5 compare match or input capture 1: enables tcntv_5 to be cleared to h'0000 at tcntv_5 and tgrv_5 compare match or input capture
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 282 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 cmpclr5w 0 r/w tcnt compare clear 5w enables or disables requests to clear tcntw_5 at tgrw_5 compare match or input capture. 0: disables tcntw_5 to be cleared to h'0000 at tcntw_5 and tgrw_5 compare match or input capture 1: enables tcntw_5 to be cleared to h'0000 at tcntw_5 and tgrw_5 compare match or input capture 10.3.5 timer interrupt enable register (tier) the tier registers are 8-bit read able/writable registers that control enabling or disabling of interrupt requests for each channel. the mtu2 has seven tier registers, two for channel 0 and one each for channels 1 to 5. ? tier_0, tier_1, tier_2, tier_3, tier_4 76543210 bit: initial value: r/w: 00000000 r/w r/w r/w r/w r/w r/w r/w r/w ttge ttge2 tcieu tciev tgied tgiec tgieb tgiea bit bit name initial value r/w description 7 ttge 0 r/w a/d converter start request enable enables or disables generation of a/d converter start requests by tgra input capture/compare match. 0: a/d converter start request generation disabled 1: a/d converter start request generation enabled
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 283 of 1080 rej09b0230-0300 bit bit name initial value r/w description 6 ttge2 0 r/w a/d converter start request enable 2 enables or disables generation of a/d converter start requests by tcnt_4 underflow (trough) in complementary pwm mode. in channels 0 to 3, bit 6 is reserved. it is always read as 0 and the write value should always be 0. 0: a/d converter start request generation by tcnt_4 underflow (trough) disabled 1: a/d converter start request generation by tcnt_4 underflow (trough) enabled 5 tcieu 0 r/w underflow interrupt enable enables or disables interrupt requests (tciu) by the tcfu flag when the tcfu flag in tsr is set to 1 in channels 1 and 2. in channels 0, 3, and 4, bit 5 is reserved. it is always read as 0 and the write value should always be 0. 0: interrupt requests (tciu) by tcfu disabled 1: interrupt requests (tciu) by tcfu enabled 4 tciev 0 r/w overflow interrupt enable enables or disables interrupt requests (tciv) by the tcfv flag when the tcfv flag in tsr is set to 1. 0: interrupt requests (tciv) by tcfv disabled 1: interrupt requests (tciv) by tcfv enabled 3 tgied 0 r/w tgr interrupt enable d enables or disables interrupt requests (tgid) by the tgfd bit when the tgfd bit in tsr is set to 1 in channels 0, 3, and 4. in channels 1 and 2, bit 3 is reserved. it is always read as 0 and the write value should always be 0. 0: interrupt requests (tgid) by tgfd bit disabled 1: interrupt requests (tgid) by tgfd bit enabled
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 284 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 tgiec 0 r/w tgr interrupt enable c enables or disables interrupt requests (tgic) by the tgfc bit when the tgfc bit in tsr is set to 1 in channels 0, 3, and 4. in channels 1 and 2, bit 2 is reserved. it is always read as 0 and the write value should always be 0. 0: interrupt requests (tgic) by tgfc bit disabled 1: interrupt requests (tgic) by tgfc bit enabled 1 tgieb 0 r/w tgr interrupt enable b enables or disables interrupt requests (tgib) by the tgfb bit when the tgfb bit in tsr is set to 1. 0: interrupt requests (tgib) by tgfb bit disabled 1: interrupt requests (tgib) by tgfb bit enabled 0 tgiea 0 r/w tgr interrupt enable a enables or disables interrupt requests (tgia) by the tgfa bit when the tgfa bit in tsr is set to 1. 0: interrupt requests (tgia) by tgfa bit disabled 1: interrupt requests (tgia) by tgfa bit enabled
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 285 of 1080 rej09b0230-0300 ? tier2_0 bit: initial value: r/w: 7654321 0 00000000 r/w r r r r r r/w r/w ttge2 - - - - - tgief tgiee bit bit name initial value r/w description 7 ttge2 0 r/w a/d converter start request enable 2 enables or disables generation of a/d converter start requests by compare match between tcnt_0 and tgre_0. 0: a/d converter start request generation by compare match between tcnt_0 and tgre_0 disabled 1: a/d converter start request generation by compare match between tcnt_0 and tgre_0 enabled 6 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 tgief 0 r/w tgr interrupt enable f enables or disables interrupt requests by compare match between tcnt_0 and tgrf_0. 0: interrupt requests (tgif) by tgfe bit disabled 1: interrupt requests (tgif) by tgfe bit enabled 0 tgiee 0 r/w tgr interrupt enable e enables or disables interrupt requests by compare match between tcnt_0 and tgre_0. 0: interrupt requests (tgie) by tgee bit disabled 1: interrupt requests (tgie) by tgee bit enabled
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 286 of 1080 rej09b0230-0300 ? tier_5 bit: initial value: r/w: 7654321 0 00000000 r r r r r r/w r/w r/w -----tg ie5u tgie5v tgie5w bit bit name initial value r/w description 7 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 tgie5u 0 r/w tgr interrupt enable 5u enables or disables the interrupt request (tgiu_5) by the cmfu5 bit when the cmfu5 bit in tsr_5 is set to 1. 0: interrupt request (tgiu_5) disabled 1: interrupt request (tgiu_5) enabled 1 tgie5v 0 r/w tgr interrupt enable 5v enables or disables the interrupt request (tgiv_5) by the cmfv5 bit when the cmfv5 bit in tsr_5 is set to 1. 0: interrupt request (tgiv_5) disabled 1: interrupt request (tgiv_5) enabled 0 tgie5w 0 r/w tgr interrupt enable 5w enables or disables the interrupt request (tgiw_5) by the cmfw5 bit when the cmfw5 bit in tsr_5 is set to 1. 0: interrupt request (tgiw_5) disabled 1: interrupt request (tgiw_5) enabled
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 287 of 1080 rej09b0230-0300 10.3.6 timer status register (tsr) the tsr registers are 8-bit readable /writable registers that indicate the status of each channel. the mtu2 has seven tsr registers, two for cha nnel 0 and one each for channels 1 to 5. ? tsr_0, tsr_1, tsr_2, tsr_3, tsr_4 bit: initial value: r/w: 7654321 0 11000000 rr r/(w) * 1 r/(w) * 1 r/(w) * 1 r/(w) * 1 r/(w) * 1 r/(w) * 1 note: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. 1. tcfd - tcfu tcfv tgfd tgfc tgfb tgfa bit bit name initial value r/w description 7 tcfd 1 r count direction flag status flag that shows the direction in which tcnt counts in channels 1 to 4. in channel 0, bit 7 is reserved. it is always read as 1 and the write value should always be 1. 0: tcnt counts down 1: tcnt counts up 6 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 5 tcfu 0 r/(w) * 1 underflow flag status flag that indicates that tcnt underflow has occurred when channels 1 and 2 are set to phase counting mode. only 0 can be written, for flag clearing. in channels 0, 3, and 4, bit 5 is reserved. it is always read as 0 and the write value should always be 0. [setting condition] ? when the tcnt value underflows (changes from h'0000 to h'ffff) [clearing condition] ? when 0 is written to tcfu after reading tcfu = 1 * 2
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 288 of 1080 rej09b0230-0300 bit bit name initial value r/w description 4 tcfv 0 r/(w) * 1 overflow flag status flag that indicates that tcnt overflow has occurred. only 0 can be written, for flag clearing. [setting condition] ? when the tcnt value overflows (changes from h'ffff to h'0000) in channel 4, when the tcnt_4 value underflows (changes from h'0001 to h'0000) in complementary pwm mode, this flag is also set. [clearing condition] ? when 0 is written to tcfv after reading tcfv = 1 * 2 in channel 4, when dtc is activated by tciv interrupt and the disel bit of mrb in dtc is 0, this flag is also cleared. 3 tgfd 0 r/(w) * 1 input capture/output compare flag d status flag that indicates the occurrence of tgrd input capture or compare match in channels 0, 3, and 4. only 0 can be written, for flag clearing. in channels 1 and 2, bit 3 is reserved. it is always read as 0 and the write value should always be 0. [setting conditions] ? when tcnt = tgrd and tgrd is functioning as output compare register ? when tcnt value is transferred to tgrd by input capture signal and tgrd is functioning as input capture register [clearing conditions] ? when dtc is activated by tgid interrupt and the disel bit of mrb in dtc is 0 ? when 0 is written to tgfd after reading tgfd = 1 * 2
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 289 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 tgfc 0 r/(w) * 1 input capture/output compare flag c status flag that indicates the occurrence of tgrc input capture or compare match in channels 0, 3, and 4. only 0 can be written, for flag clearing. in channels 1 and 2, bit 2 is reserved. it is always read as 0 and the write value should always be 0. [setting conditions] ? when tcnt = tgrc and tgrc is functioning as output compare register ? when tcnt value is transferred to tgrc by input capture signal and tgrc is functioning as input capture register [clearing conditions] ? when dtc is activated by tgic interrupt and the disel bit of mrb in dtc is 0 ? when 0 is written to tgfc after reading tgfc = 1 * 2 1 tgfb 0 r/(w) * 1 input capture/output compare flag b status flag that indicates the occurrence of tgrb input capture or compare match. only 0 can be written, for flag clearing. [setting conditions] ? when tcnt = tgrb and tgrb is functioning as output compare register ? when tcnt value is transferred to tgrb by input capture signal and tgrb is functioning as input capture register [clearing conditions] ? when dtc is activated by tgib interrupt and the disel bit of mrb in dtc is 0 ? when 0 is written to tgfb after reading tgfb = 1 * 2
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 290 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 tgfa 0 r/(w) * 1 input capture/output compare flag a status flag that indicates the occurrence of tgra input capture or compare match. only 0 can be written, for flag clearing. [setting conditions] ? when tcnt = tgra and tgra is functioning as output compare register ? when tcnt value is transferred to tgra by input capture signal and tgra is functioning as input capture register [clearing conditions] ? when dtc is activated by tgia interrupt and the disel bit of mrb in dtc is 0 ? when 0 is written to tgfa after reading tgfa = 1 * 2 notes: 1. writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 2. if another flag setting condition occurs before writing 0 to the bit after reading it as 1, the flag will not be cleared by writing 0 to it once. in this case, read the bit as 1 again and write 0 to it.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 291 of 1080 rej09b0230-0300 ? tsr2_0 bit: initial value: r/w: 7654321 0 11000000 rrrrrr r/(w) * 1 r/(w) * 1 note: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. 1. - - - - - - tgff tgfe bit bit name initial value r/w description 7, 6 ? all 1 r reserved these bits are always read as 1. the write value should always be 1. 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 tgff 0 r/(w) * 1 compare match flag f status flag that indicates the occurrence of compare match between tcnt_0 and tgrf_0. [setting condition] ? when tcnt_0 = tgrf_0 and tgff is functioning as compare register [clearing condition] ? when 0 is written to tgff after reading tgff = 1 * 2 0 tgfe 0 r/(w) * 1 compare match flag e status flag that indicates the occurrence of compare match between tcnt_0 and tgre_0. [setting condition] ? when tcnt_0 = tgre_0 and tgef is functioning as compare register [clearing condition] ? when 0 is written to tgfe after reading tgfe = 1 * 2 notes: 1. writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 2. if another flag setting condition occurs before writing 0 to the bit after reading it as 1, the flag will not be cleared by writing 0 to it once. in this case, read the bit as 1 again and write 0 to it.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 292 of 1080 rej09b0230-0300 ? tsr_5 bit: initial value: r/w: 7654321 0 00000000 rrrrr r/(w) * 1 r/(w) * 1 r/(w) * 1 note: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. 1. - - - - - cmfu5 cmfv5 cmfw5 bit bit name initial value r/w description 7 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 cmfu5 0 r/(w) * 1 compare match/input capture flag u5 status flag that indicates the occurrence of tgru_5 input capture or compare match. [setting conditions] ? when tcntu_5 = tgru_5 and tgru_5 is functioning as output compare register ? when tcntu_5 value is transferred to tgru_5 by input capture signal and tgru_5 is functioning as input capture register ? when tcntu_5 value is transferred to tgru_5 and tgru_5 is functioning as a register for measuring the pulse width of the external input signal .* 2 [clearing conditions] ? when dtc is activated by a tgiu_5 interrupt and the disel bit of mrb in dtc is 0 ? when 0 is written to cmfu5 after reading cmfu5 = 1
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 293 of 1080 rej09b0230-0300 bit bit name initial value r/w description 1 cmfv5 0 r/(w) * 1 compare match/input capture flag v5 status flag that indicates the occurrence of tgrv_5 input capture or compare match. [setting conditions] ? when tcntv_5 = tgrv_5 and tgrv_5 is functioning as output compare register ? when tcntv_5 value is transferred to tgrv_5 by input capture signal and tgrv_5 is functioning as input capture register ? when tcntv_5 value is transferred to tgrv_5 and tgrv_5 is functioning as a register for measuring the pulse width of the external input signal. * 2 [clearing conditions] ? when dtc is activated by a tgiv_5 interrupt and the disel bit of mrb in dtc is 0 ? when 0 is written to cmfv5 after reading cmfv5 = 1 0 cmfw5 0 r/(w) * 1 compare match/input capture flag w5 status flag that indicates the occurrence of tgrw_5 input capture or compare match. [setting conditions] ? when tcntw_5 = tgrw_5 and tgrw_5 is functioning as output compare register ? when tcntw_5 value is transferred to tgrw_5 by input capture signal and tgrw_5 is functioning as input capture register ? when tcntw_5 value is transferred to tgrw_5 and tgrw_5 is functioning as a register for measuring the pulse width of the external input signal . * 2 [clearing conditions] ? when dtc is activated by a tgiw_5 interrupt and the disel bit of mrb in dtc is 0 ? when 0 is written to cmfw5 after reading cmfw5 = 1 notes: 1. writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 2. the transfer timing is specified by the ioc bit in timer i/o control register u_5/v_5/w_5 (tioru_5, tiorv_5, tiorw_5).
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 294 of 1080 rej09b0230-0300 10.3.7 timer buffer operation tran sfer mode register (tbtm) the tbtm registers are 8-bit read able/writable registers that specify the timing for transferring data from the buffer register to the timer general register in pwm mode. the mtu2 has three tbtm registers, one each for channels 0, 3, and 4. bit: initial value: r/w: 7654321 0 00000000 r r r r r r/w r/w r/w ----- ttse ttsb ttsa bit bit name initial value r/w description 7 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 ttse 0 r/w timing select e specifies the timing for transferring data from tgrf_0 to tgre_0 when they are used together for buffer operation. in channels 3 and 4, bit 2 is reserved. it is always read as 0 and the write value should always be 0. when using channel 0 in other than pwm mode, do not set this bit to 1. 0: when compare match e occurs in channel 0 1: when tcnt_0 is cleared 1 ttsb 0 r/w timing select b specifies the timing for transferring data from tgrd to tgrb in each channel when they are used together for buffer operation. when using a channel in other than pwm mode, do not set this bit to1. 0: when compare match b occurs in each channel 1: when tcnt is cleared in each channel
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 295 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 ttsa 0 r/w timing select a specifies the timing for transferring data from tgrc to tgra in each channel when they are used together for buffer operation. when using a channel in other than pwm mode, do not set this bit to1. 0: when compare match a occurs in each channel 1: when tcnt is cleared in each channel 10.3.8 timer input capture control register (ticcr) ticcr is an 8-bit readable/writable register that specifies i nput capture conditions when tcnt_1 and tcnt_2 are cascaded. the mtu2 has one ticcr in channel 1. bit: initial value: r/w: 7654321 0 00000000 r r r r r/w r/w r/w r/w - - - - i2be i2ae i1be i1ae bit bit name initial value r/w description 7 to 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 i2be 0 r/w input capture enable specifies whether to include the tioc2b pin in the tgrb_1 input capture conditions. 0: does not include the tioc2b pin in the tgrb_1 input capture conditions 1: includes the tioc2b pin in the tgrb_1 input capture conditions
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 296 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 i2ae 0 r/w input capture enable specifies whether to include the tioc2a pin in the tgra_1 input capture conditions. 0: does not include the tioc2a pin in the tgra_1 input capture conditions 1: includes the tioc2a pin in the tgra_1 input capture conditions 1 i1be 0 r/w input capture enable specifies whether to include the tioc1b pin in the tgrb_2 input capture conditions. 0: does not include the tioc1b pin in the tgrb_2 input capture conditions 1: includes the tioc1b pin in the tgrb_2 input capture conditions 0 i1ae 0 r/w input capture enable specifies whether to include the tioc1a pin in the tgra_2 input capture conditions. 0: does not include the tioc1a pin in the tgra_2 input capture conditions 1: includes the tioc1a pin in the tgra_2 input capture conditions
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 297 of 1080 rej09b0230-0300 10.3.9 timer synchronous clear register (tsycr) tsycr is an 8-bit readable/writable register that specifies conditions for clearing tcnt_3 and tcnt_4 in the mtu2s in synchronization with the mtu2. the mtu2s has one tsycr in channel 3 but the mtu2 has no tsycr. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w ce0a ce0b ce0c ce0d ce1a ce1b ce2a ce2b bit bit name initial value r/w description 7 ce0a 0 r/w clear enable 0a enables or disables counter clearing when the tgfa flag of tsr_0 in the mtu2 is set. 0: disables counter clearing by the tgfa flag in tsr_0 1: enables counter clearing by the tgfa flag in tsr_0 6 ce0b 0 r/w clear enable 0b enables or disables counter clearing when the tgfb flag of tsr_0 in the mtu2 is set. 0: disables counter clearing by the tgfb flag in tsr_0 1: enables counter clearing by the tgfb flag in tsr_0 5 ce0c 0 r/w clear enable 0c enables or disables counter clearing when the tgfc flag of tsr_0 in the mtu2 is set. 0: disables counter clearing by the tgfc flag in tsr_0 1: enables counter clearing by the tgfc flag in tsr_0 4 ce0d 0 r/w clear enable 0d enables or disables counter clearing when the tgfd flag of tsr_0 in the mtu2 is set. 0: disables counter clearing by the tgfd flag in tsr_0 1: enables counter clearing by the tgfd flag in tsr_0
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 298 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 ce1a 0 r/w clear enable 1a enables or disables counter clearing when the tgfa flag of tsr_1 in the mtu2 is set. 0: disables counter clearing by the tgfa flag in tsr_1 1: enables counter clearing by the tgfa flag in tsr_1 2 ce1b 0 r/w clear enable 1b enables or disables counter clearing when the tgfb flag of tsr_1 in the mtu2 is set. 0: disables counter clearing by the tgfb flag in tsr_1 1: enables counter clearing by the tgfb flag in tsr_1 1 ce2a 0 r/w clear enable 2a enables or disables counter clearing when the tgfa flag of tsr_2 in the mtu2 is set. 0: disables counter clearing by the tgfa flag in tsr_2 1: enables counter clearing by the tgfa flag in tsr_2 0 ce2b 0 r/w clear enable 2b enables or disables counter clearing when the tgfb flag of tsr_2 in the mtu2 is set. 0: disables counter clearing by the tgfb flag in tsr_2 1: enables counter clearing by the tgfb flag in tsr_2
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 299 of 1080 rej09b0230-0300 10.3.10 timer a/d converter start request control register (tadcr) tadcr is a 16-bit readable/writable register that enables or disables a/d converter start requests and specifies whether to link a/d converter start requests with interrupt skipping operation. the mtu2 has one tadcr in channel 4. bit: initial value: r/w: 151413121110987654321 0 0000000000 * 00 * 0 * 0 * 0 * 0 * r/w r/w r r r r r r r/w r/w r/w r/w r/w r/w r/w r/w note: do not set to 1 when complementary pwm mode is not selected. * bf[1:0] - - - - - - ut4ae dt4ae ut4be dt4be ita3ae ita4ve itb3ae itb4ve bit bit name initial value r/w description 15, 14 bf[1:0] 00 r/w tadcobra_4/tadcobrb_4 transfer timing select select the timing for transferring data from tadcobra_4 and tadcobrb_4 to tadcora_4 and tadcorb_4. for details, see table 10.32. 13 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 ut4ae 0 r/w up-count trg4an enable enables or disables a/d converter start requests (trg4an) during tcnt_4 up-count operation. 0: a/d converter start requests (trg4an) disabled during tcnt_4 up-count operation 1: a/d converter start requests (trg4an) enabled during tcnt_4 up-count operation 6 dt4ae 0 * r/w down-count trg4an enable enables or disables a/d converter start requests (trg4an) during tcnt_4 down-count operation. 0: a/d converter start requests (trg4an) disabled during tcnt_4 down-count operation 1: a/d converter start requests (trg4an) enabled during tcnt_4 down-count operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 300 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 ut4be 0 r/w up-count trg4bn enable enables or disables a/d converter start requests (trg4bn) during tcnt_4 up-count operation. 0: a/d converter start requests (trg4bn) disabled during tcnt_4 up-count operation 1: a/d converter start requests (trg4bn) enabled during tcnt_4 up-count operation 4 dt4be 0 * r/w down-count trg4bn enable enables or disables a/d converter start requests (trg4bn) during tcnt_4 down-count operation. 0: a/d converter start requests (trg4bn) disabled during tcnt_4 down-count operation 1: a/d converter start requests (trg4bn) enabled during tcnt_4 down-count operation 3 ita3ae 0 * r/w tgia_3 interrupt skipping link enable select whether to link a/d converter start requests (trg4an) with tgia_3 interrupt skipping operation. 0: does not link with tgia_3 interrupt skipping 1: links with tgia_3 interrupt skipping 2 ita4ve 0 * r/w tciv_4 interrupt skipping link enable select whether to link a/d converter start requests (trg4an) with tciv_4 interrupt skipping operation. 0: does not link with tciv_4 interrupt skipping 1: links with tciv_4 interrupt skipping 1 itb3ae 0 * r/w tgia_3 interrupt skipping link enable select whether to link a/d converter start requests (trg4bn) with tgia_3 interrupt skipping operation. 0: does not link with tgia_3 interrupt skipping 1: links with tgia_3 interrupt skipping
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 301 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 itb4ve 0 * r/w tciv_4 interrupt skipping link enable select whether to link a/d converter start requests (trg4bn) with tciv_4 interrupt skipping operation. 0: does not link with tciv_4 interrupt skipping 1: links with tciv_4 interrupt skipping notes: 1. tadcr must not be accessed in eight bits; it should always be accessed in 16 bits. 2. when interrupt skipping is disabled (the t3aen and t4ven bits in the timer interrupt skipping set register (titcr) are cleared to 0 or the skipping count set bits (3acor and 4vcor) in titcr are cleared to 0), do not link a/d converter start requests with interrupt skipping operation (clear the ita3ae, ita4ve, itb3ae, and itb4ve bits in the timer a/d converter start request control register (tadcr) to 0). 3. if link with interrupt skipping is enabled while interrupt skipping is disabled, a/d converter start requests will not be issued. * do not set to 1 when complementary pwm mode is not selected. table 10.32 setting of transfer timing by bits bf1 and bf0 bit 7 bit 6 bf1 bf0 description 0 0 does not transfer data from the cycle set buffer register to the cycle set register. 0 1 transfers data from the cycle set buffer register to the cycle set register at the crest of the tcnt_4 count. * 1 1 0 transfers data from the cycle set buffer register to the cycle set register at the trough of the tcnt_4 count. * 2 1 1 transfers data from the cycle set buffer register to the cycle set register at the crest and trough of the tcnt_4 count. * 2 notes: 1. data is transferred from the cycle set buffer register to the cycle set register when the crest of the tcnt_4 count is reached in complementary pwm mode, when compare match occurs between tcnt_3 and tgra_3 in reset-synchronized pwm mode, or when compare match occurs between tcnt_4 and tgra_4 in pwm mode 1 or normal operation mode. 2. these settings are prohibited when complementary pwm mode is not selected.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 302 of 1080 rej09b0230-0300 10.3.11 timer a/d converter start request cycle set registers (tadcora_4 and tadcorb_4) tadcora_4 and tadcorb_4 are 16-bit readable/writable registers. when the tcnt_4 count reaches the value in tadcora_4 or tadcorb_4, a corresponding a/d converter start request will be issued. tadcora_4 and tadcorb_4 are initialized to h'ffff. bit: initial value: r/w: 151413121110987654321 0 1111111111111111 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w note: tadcora_4 and tadcorb_4 must not be accessed in ei g ht bits; they should always be accessed in 16 bits. 10.3.12 timer a/d converter start request cycle set buffer registers (tadcobra_4 and tadcobrb_4) tadcobra_4 and tadcobrb_4 are 16-bit readable /writable registers. when the crest or trough of the tcnt_4 count is reached, these regi ster values are transferred to tadcora_4 and tadcorb_4, respectively. tadcobra_4 and tadcobrb_4 are initialized to h'ffff. bit: initial value: r/w: 151413121110987654321 0 1111111111111111 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w note: tadcobra_4 and tadcobrb_4 must not be accessed in ei g ht bits; they should always be accessed in 16 bits.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 303 of 1080 rej09b0230-0300 10.3.13 timer counter (tcnt) the tcnt counters are 16-bit readable/writable counters. the mtu2 has eight tcnt counters, one each for channels 0 to 4 and three (tcntu_5, tcntv_5, and tcntw_5) for channel 5. the tcnt counters are initialized to h'0000 by a reset. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w note: the tcnt counters must not be accessed in ei g ht bits; they should always be accessed in 16 bits. 10.3.14 timer general register (tgr) the tgr registers are 16-bit readable/writable regi sters. the mtu2 has 21 tgr registers, six for channel 0, two each for channels 1 and 2, four each for channels 3 and 4, and three for channel 5. tgra, tgrb, tgrc, and tgrd function as either output compare or input capture registers. tgrc and tgrd for channels 0, 3, and 4 can also be designated for operation as buffer registers. tgr buffer register combinations are tgra and tgrc, and tgrb and tgrd. tgre_0 and tgrf_0 function as compare registers. when the tcnt_0 count matches the tgre_0 value, an a/d converter start request can be issued. tgrf can also be designated for operation as a buffer register. tgr buffer register combination is tgre and tgrf. tgru_5, tgrv_5, and tgrw_5 function as compare match, input capture, or external pulse width measurement registers. bit: initial value: r/w: 151413121110987654321 0 1111111111111111 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w note: the tgr re g isters must not be accessed in ei g ht bits; they should always be accessed in 16 bits. tgr re g isters are initialized to h'ffff.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 304 of 1080 rej09b0230-0300 10.3.15 timer start register (tstr) tstr is an 8-bit readable/writable register that selects operation/stoppage of tcnt for channels 0 to 4. tstr_5 is an 8-bit readable/writable register that selects operation/stoppage of tcntu_5, tcntv_5, and tcntw_5 for channel 5. when setting the operating mode in tmdr or setting the count clock in tcr, first stop the tcnt counter. ? tstr bit: initial value: r/w: 7654321 0 00000000 r/w r/w r r r r/w r/w r/w cst4 cst3 - - - cst2 cst1 cst0 bit bit name initial value r/w description 7 cst4 0 r/w 6 cst3 0 r/w counter start 4 and 3 these bits select operation or stoppage for tcnt. if 0 is written to the cst bit during operation with the tioc pin designated for output, the counter stops but the tioc pin output compare output level is retained. if tior is written to when the cst bit is cleared to 0, the pin output level will be changed to the set initial output value. 0: tcnt_4 and tcnt_3 count operation is stopped 1: tcnt_4 and tcnt_3 performs count operation 5 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 305 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 cst2 0 r/w 1 cst1 0 r/w 0 cst0 0 r/w counter start 2 to 0 these bits select operation or stoppage for tcnt. if 0 is written to the cst bit during operation with the tioc pin designated for output, the counter stops but the tioc pin output compare output level is retained. if tior is written to when the cst bit is cleared to 0, the pin output level will be changed to the set initial output value. 0: tcnt_2 to tcnt_0 count operation is stopped 1: tcnt_2 to tcnt_0 performs count operation ? tstr_5 bit : initial value: r/w: 7654321 0 00000000 r r r r r r/w r/w r/w - - - - - cstu5 cstv5 cstw5 bit bit name initial value r/w description 7 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 cstu5 0 r/w counter start u5 selects operation or stoppage for tcntu_5. 0: tcntu_5 count operation is stopped 1: tcntu_5 performs count operation 1 cstv5 0 r/w counter start v5 selects operation or stoppage for tcntv_5. 0: tcntv_5 count operation is stopped 1: tcntv_5 performs count operation 0 cstw5 0 r/w counter start w5 selects operation or stoppage for tcntw_5. 0: tcntw_5 count operation is stopped 1: tcntw_5 performs count operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 306 of 1080 rej09b0230-0300 10.3.16 timer synchronous register (tsyr) tsyr is an 8-bit readable/writable register that selects independent operation or synchronous operation for the channel 0 to 4 tcnt counters. a channel performs synchronous operation when the corresponding bit in tsyr is set to 1. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r r r r/w r/w r/w sync4 sync3 - - - sync2 sync1 sync0 bit bit name initial value r/w description 7 sync4 0 r/w 6 sync3 0 r/w timer synchronous operation 4 and 3 these bits are used to select whether operation is independent of or synchronized with other channels. when synchronous operation is selected, the tcnt synchronous presetting of multiple channels, and synchronous clearing by counter clearing on another channel, are possible. to set synchronous operation, the sync bits for at least two channels must be set to 1. to set synchronous clearing, in addition to the sync bit , the tcnt clearing source must also be set by means of bits cclr0 to cclr2 in tcr. 0: tcnt_4 and tcnt_3 operate independently (tcnt presetting/clearing is unrelated to other channels) 1: tcnt_4 and tcnt_3 performs synchronous operation tcnt synchronous presetting/synchronous clearing is possible 5 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 307 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 sync2 0 r/w 1 sync1 0 r/w 0 sync0 0 r/w timer synchronous operation 2 to 0 these bits are used to select whether operation is independent of or synchronized with other channels. when synchronous operation is selected, the tcnt synchronous presetting of multiple channels, and synchronous clearing by counter clearing on another channel, are possible. to set synchronous operation, the sync bits for at least two channels must be set to 1. to set synchronous clearing, in addition to the sync bit, the tcnt clearing source must also be set by means of bits cclr0 to cclr2 in tcr. 0: tcnt_2 to tcnt_0 operates independently (tcnt presetting /clearing is unrelated to other channels) 1: tcnt_2 to tcnt_0 performs synchronous operation tcnt synchronous presetting/synchronous clearing is possible
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 308 of 1080 rej09b0230-0300 10.3.17 timer counter synchronous start register (tcsystr) tcsystr is an 8-bit readable/writable register th at specifies synchronous start of the mtu2 and mtu2s counters. note that the mtu2s does not have tcsystr. bit: initial value: r/w: 7654321 0 00000000 r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r r/(w) * r/(w) * note: only 1 can be written to set the re g ister. * sch0 sch1 sch2 sch3 sch4 - sch3s sch4s bit bit name initial value r/w description 7 sch0 0 r/(w) * synchronous start controls synchronous start of tcnt_0 in the mtu2. 0: does not specify synchronous start for tcnt_0 in the mtu2 1: specifies synchronous start for tcnt_0 in the mtu2 [clearing condition] ? when 1 is set to the cst0 bit of tstr in mtu2 while sch0 = 1 6 sch1 0 r/(w) * synchronous start controls synchronous start of tcnt_1 in the mtu2. 0: does not specify synchronous start for tcnt_1 in the mtu2 1: specifies synchronous start for tcnt_1 in the mtu2 [clearing condition] ? when 1 is set to the cst1 bit of tstr in mtu2 while sch1 = 1
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 309 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 sch2 0 r/(w) * synchronous start controls synchronous start of tcnt_2 in the mtu2. 0: does not specify synchronous start for tcnt_2 in the mtu2 1: specifies synchronous start for tcnt_2 in the mtu2 [clearing condition] ? when 1 is set to the cst2 bit of tstr in mtu2 while sch2 = 1 4 sch3 0 r/(w) * synchronous start controls synchronous start of tcnt_3 in the mtu2. 0: does not specify synchronous start for tcnt_3 in the mtu2 1: specifies synchronous start for tcnt_3 in the mtu2 [clearing condition] ? when 1 is set to the cst3 bit of tstr in mtu2 while sch3 = 1 3 sch4 0 r/(w) * synchronous start controls synchronous start of tcnt_4 in the mtu2. 0: does not specify synchronous start for tcnt_4 in the mtu2 1: specifies synchronous start for tcnt_4 in the mtu2 [clearing condition] ? when 1 is set to the cst4 bit of tstr in mtu2 while sch4 = 1 2 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 310 of 1080 rej09b0230-0300 bit bit name initial value r/w description 1 sch3s 0 r/(w) * synchronous start controls synchronous start of tcnt_3s in the mtu2s. 0: does not specify synchronous start for tcnt_3s in the mtu2s 1: specifies synchronous start for tcnt_3s in the mtu2s [clearing condition] ? when 1 is set to the cst3 bit of tstrs in mtu2s while sch3s = 1 0 sch4s 0 r/(w) * synchronous start controls synchronous start of tcnt_4s in the mtu2s. 0: does not specify synchronous start for tcnt_4s in the mtu2s 1: specifies synchronous start for tcnt_4s in the mtu2s [clearing condition] ? when 1 is set to the cst4 bit of tstrs in mtu2s while sch4s = 1 note: * only 1 can be written to set the register.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 311 of 1080 rej09b0230-0300 10.3.18 timer read/write enable register (trwer) trwer is an 8-bit readab le/writable register that enables or disables access to the registers and counters which have write-protection capability agai nst accidental modificatio n in channels 3 and 4. bit: initial value: r/w: 7654321 0 00000001 rrrrrrrr/w -------rwe bit bit name initial value r/w description 7 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 rwe 1 r/w read/write enable enables or disables access to the registers which have write-protection capability against accidental modification. 0: disables read/write access to the registers 1: enables read/write access to the registers [clearing condition] ? when 0 is written to the rwe bit after reading rwe = 1 ? registers and counters having write-protection capability ag ainst accidental modification 22 registers: tcr_3, tcr_4, tmdr_3, tmdr_4, tiorh_3, tiorh_4, tiorl_3, tiorl_4, tier_3, tier_4, tgra_3, tg ra_4, tgrb_3, tgrb_4, toer, tocr1, tocr2, tgcr, tcdr, tddr, tcnt_3, and tcnt4.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 312 of 1080 rej09b0230-0300 10.3.19 timer output master enable register (toer) toer is an 8-bit readable/writable register that enables/disables output settings for output pins tioc4d, tioc4c, tioc3d, tioc4b, tioc4a, and tioc3b. these pins do not output correctly if the toer bits have not been set. set toer of ch3 and ch4 prior to setting tior of ch3 and ch4. bit: initial value: r/w: 7654321 0 11000000 r r r/w r/w r/w r/w r/w r/w - - oe4d oe4c oe3d oe4b oe4a oe3b bit bit name initial value r/w description 7, 6 ? all 1 r reserved these bits are always read as 1. the write value should always be 1. 5 oe4d 0 r/w master enable tioc4d this bit enables/disables the tioc4d pin mtu2 output. 0: mtu2 output is disabled (inactive level) * 1: mtu2 output is enabled 4 oe4c 0 r/w master enable tioc4c this bit enables/disables the tioc4c pin mtu2 output. 0: mtu2 output is disabled (inactive level) * 1: mtu2 output is enabled 3 oe3d 0 r/w master enable tioc3d this bit enables/disables the tioc3d pin mtu2 output. 0: mtu2 output is disabled (inactive level) * 1: mtu2 output is enabled 2 oe4b 0 r/w master enable tioc4b this bit enables/disables the tioc4b pin mtu2 output. 0: mtu2 output is disabled (inactive level) * 1: mtu2 output is enabled 1 oe4a 0 r/w master enable tioc4a this bit enables/disables the tioc4a pin mtu2 output. 0: mtu2 output is disabled (inactive level) * 1: mtu2 output is enabled
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 313 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 oe3b 0 r/w master enable tioc3b this bit enables/disables the tioc3b pin mtu2 output. 0: mtu2 output is disabled (inactive level) * 1: mtu2 output is enabled note: * the inactive level is determined by the settings in timer output control registers 1 and 2 (tocr1 and tocr2). for details, refer to section 10.3.20, timer output control register 1 (tocr1), and section 10.3.21, timer output control register 2 (tocr2). set these bits to 1 to enable mtu2 output in other than complementary pwm or reset- synchronized pwm mode. when these bits are set to 0, low level is output. 10.3.20 timer output control register 1 (tocr1) tocr1 is an 8-bit readable/writable register that enables/disables pwm synchronized toggle output in complementary pwm mode/reset synchronized pwm mode, and controls output level inversion of pwm output. bit: initial value: r/w: 7654321 0 00000000 r r/w r r r/(w) * r/w r/w r/w note: this bit can be set to 1 only once after a power-on reset. after 1 is written, 0 cannot be written to the bit. * - psye - - tocl tocs olsn olsp bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 psye 0 r/w pwm synchronous output enable this bit selects the enable/disable of toggle output synchronized with the pwm period. 0: toggle output is disabled 1: toggle output is enabled 5, 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 314 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 tocl 0 r/(w) * 1 toc register write protection * 2 this bit selects the enable/disable of write access to the tocs, olsn, and olsp bits in tocr1. 0: write access to the tocs, olsn, and olsp bits is enabled 1: write access to the tocs, olsn, and olsp bits is disabled 2 tocs 0 r/w toc select this bit selects either the tocr1 or tocr2 setting to be used for the output level in complementary pwm mode and reset-synchronized pwm mode. 0: tocr1 setting is selected 1: tocr2 setting is selected 1 olsn 0 r/w output level select n * 3 this bit selects the reverse phase output level in reset- synchronized pwm mode/complementary pwm mode. see table 10.33. 0 olsp 0 r/w output level select p * 3 this bit selects the positive phase output level in reset- synchronized pwm mode/complementary pwm mode. see table 10.34. notes: 1. this bit can be set to 1 only after a power on reset. after 1 is written, 0 cannot be written to the bit. 2. setting the tocl bit to 1 prevents accidental modification when the cpu goes out of control. 3. clearing the tocs0 bit to 0 makes this bit setting valid. table 10.33 output level select function bit 1 function compare match output olsn initial output active level up count down count 0 high level low level high level low level 1 low level high level low level high level note: the reverse phase waveform initial output value changes to active level after elapse of the dead time after count start.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 315 of 1080 rej09b0230-0300 table 10.34 output level select function bit 0 function compare match output olsp initial output active level up count down count 0 high level low level low level high level 1 low level high level high level low level figure 10.3 shows an example of complementary pwm mode output (1 phase) when olsn = 1, olsp = 1. tcnt_3 and tcnt_4 values tgra_3 tgra_4 tddr h'0000 time tcnt_4 tcnt_3 positive phase output reverse phase output active level compare match output (up count) initial output initial output active level compare match output (down count) compare match output (down count) compare match output (up count) active level figure 10.3 complementary pwm mode output level example
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 316 of 1080 rej09b0230-0300 10.3.21 timer output control register 2 (tocr2) tocr2 is an 8-bit readable/writable register that controls output level inversion of pwm output in complementary pwm mode and reset-synchronized pwm mode. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w bf[1:0] ols3n ols3p ols2n ols2p ols1n ols1p bit bit name initial value r/w description 7, 6 bf[1:0] 00 r/w tolbr buffer transfer timing select these bits select the timing for transferring data from tolbr to tocr2. for details, see table 10.35. 5 ols3n 0 r/w output level select 3n * this bit selects the output level on tioc4d in reset- synchronized pwm mode/complementary pwm mode. see table 10.36. 4 ols3p 0 r/w output level select 3p * this bit selects the output level on tioc4b in reset- synchronized pwm mode/complementary pwm mode. see table 10.37. 3 ols2n 0 r/w output level select 2n * this bit selects the output level on tioc4c in reset- synchronized pwm mode/complementary pwm mode. see table 10.38. 2 ols2p 0 r/w output level select 2p * this bit selects the output level on tioc4a in reset- synchronized pwm mode/complementary pwm mode. see table 10.39. 1 ols1n 0 r/w output level select 1n * this bit selects the output level on tioc3d in reset- synchronized pwm mode/complementary pwm mode. see table 10.40.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 317 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 ols1p 0 r/w output level select 1p * this bit selects the output level on tioc3b in reset- synchronized pwm mode/complementary pwm mode. see table 10.41. note: * setting the tocs bit in tocr1 to 1 makes this bit setting valid. table 10.35 setting of bits bf1 and bf0 bit 7 bit 6 description bf1 bf0 complementary pwm mode reset-synchronized pwm mode 0 0 does not transfer data from the buffer register (tolbr) to tocr2. does not transfer data from the buffer register (tolbr) to tocr2. 0 1 transfers data from the buffer register (tolbr) to tocr2 at the crest of the tcnt_4 count. transfers data from the buffer register (tolbr) to tocr2 when tcnt_3/tcnt_4 is cleared 1 0 transfers data from the buffer register (tolbr) to tocr2 at the trough of the tcnt_4 count. setting prohibited 1 1 transfers data from the buffer register (tolbr) to tocr2 at the crest and trough of the tcnt_4 count. setting prohibited table 10.36 tioc4d output level select function bit 5 function compare match output ols3n initial output active level up count down count 0 high level low level high level low level 1 low level high level low level high level note: the reverse phase waveform initial output value changes to the active level after elapse of the dead time after count start.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 318 of 1080 rej09b0230-0300 table 10.37 tioc4b output level select function bit 4 function compare match output ols3p initial output active level up count down count 0 high level low level low level high level 1 low level high level high level low level table 10.38 tioc4c output level select function bit 3 function compare match output ols2n initial output active level up count down count 0 high level low level high level low level 1 low level high level low level high level note: the reverse phase waveform initial output value changes to the active level after elapse of the dead time after count start. table 10.39 tioc4a output level select function bit 2 function compare match output ols2p initial output active level up count down count 0 high level low level low level high level 1 low level high level high level low level table 10.40 tioc3d output level select function bit 1 function compare match output ols1n initial output active level up count down count 0 high level low level high level low level 1 low level high level low level high level note: the reverse phase waveform initial output value changes to the active level after elapse of the dead time after count start.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 319 of 1080 rej09b0230-0300 table 10.41 tioc3b output level select function bit 0 function compare match output ols1p initial output active level up count down count 0 high level low level low level high level 1 low level high level high level low level 10.3.22 timer output level buffer register (tolbr) tolbr is an 8-bit readable/writable register that functions as a buffer for tocr2 and specifies the pwm output level in complementary pwm mode and reset-synchronized pwm mode. bit: initial value: r/w: 7654321 0 00000000 r r r/w r/w r/w r/w r/w r/w - - ols3n ols3p ols2n ols2p ols1n ols1p bit bit name initial value r/w description 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 ols3n 0 r/w specifies the buffer value to be transferred to the ols3n bit in tocr2. 4 ols3p 0 r/w specifies the buffer value to be transferred to the ols3p bit in tocr2. 3 ols2n 0 r/w specifies the buffer value to be transferred to the ols2n bit in tocr2. 2 ols2p 0 r/w specifies the buffer value to be transferred to the ols2p bit in tocr2. 1 ols1n 0 r/w specifies the buffer value to be transferred to the ols1n bit in tocr2. 0 ols1p 0 r/w specifies the buffer value to be transferred to the ols1p bit in tocr2.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 320 of 1080 rej09b0230-0300 figure 10.4 shows an example of the pwm output level setting procedure in buffer operation. set bit tocs set tocr2 set tolbr [1] [2] [3] [1] set bit tocs in tocr1 to 1 to enable the tocr2 settin g . [2] use bits bf1 and bf0 in tocr2 to select the tolbr buffer transfer timin g . use bits ols3n to ols1n and ols3p to ols1p to specify the pwm output levels. [3] the tolbr initial settin g must be the same value as specified in bits ols3n to ols1n and ols3p to ols1p in tocr2. figure 10.4 pwm output level sett ing procedure in buffer operation 10.3.23 timer gate control register (tgcr) tgcr is an 8-bit readable/writable register that controls the waveform output necessary for brushless dc motor control in reset-synchronized pwm mode/complementary pwm mode. these register settings are ineffective for anything other than complementary pwm mode/reset- synchronized pwm mode. bit: initial value: r/w: 7654321 0 10000000 r r/w r/w r/w r/w r/w r/w r/w -bdcn pfb * wf vf uf bit bit name initial value r/w description 7 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 6 bdc 0 r/w brushless dc motor this bit selects whether to make the functions of this register (tgcr) effective or ineffective. 0: ordinary output 1: functions of this register are made effective
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 321 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 n 0 r/w reverse phase output (n) control this bit selects whether the level output or the reset- synchronized pwm/complementary pwm output while the reverse pins (tioc3d, tioc4c, and tioc4d) are output. 0: level output 1: reset synchronized pwm/complementary pwm output 4 p 0 r/w positive phase output (p) control this bit selects whether the level output or the reset- synchronized pwm/complementary pwm output while the positive pin (tioc3b, tioc4a, and tioc4b) are output. 0: level output 1: reset synchronized pwm/complementary pwm output 3 fb * 0 r/w external feedback signal enable this bit selects whether the switching of the output of the positive/reverse phase is carried out automatically with the mtu2/channel 0 tgra, tgrb, tgrc input capture signals or by writing 0 or 1 to bits 2 to 0 in tgcr. 0: output switching is external input (input sources are channel 0 tgra, tgrb, tgrc input capture signal) 1: output switching is carried out by software (setting values of uf, vf, and wf in tgcr). 2 wf 0 r/w 1 vf 0 r/w 0 uf 0 r/w output phase switch 2 to 0 these bits set the positive phase/negative phase output phase on or off state. the setting of these bits is valid only when the fb bit in this register is set to 1. in this case, the setting of bits 2 to 0 is a substitute for external input. see table 10.42. note: * when the mtu2s is used to set the bdc bit to 1, do not set the fb bit to 0.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 322 of 1080 rej09b0230-0300 table 10.42 output level select function function bit 2 bit 1 bit 0 tioc3b tioc4a tioc4b tioc3d tioc4c tioc4d wf vf uf u phase v phase w phase u phase v phase w phase 0 0 0 off off off off off off 1 on off off off off on 1 0 off on off on off off 1 off on off off off on 1 0 0 off off on off on off 1 on off off off on off 1 0 off off on on off off 1 off off off off off off 10.3.24 timer subcounter (tcnts) tcnts is a 16-bit read-only counter that is used only in complementary pwm mode. the initial value of tcnts is h'0000. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrrrrrrrrr note: accessin g the tcnts in 8-bit units is prohibited. always access in 16-bit units.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 323 of 1080 rej09b0230-0300 10.3.25 timer dead time data register (tddr) tddr is a 16-bit register, used only in complementary pwm mode that specifies the tcnt_3 and tcnt_4 counter offset values. in complementary pwm mode, when the tcnt_3 and tcnt_4 counters are cleared and then restarted, the tddr register value is loaded into the tcnt_3 counter and the count operation starts. the initial value of tddr is h'ffff. bit: initial value: r/w: 151413121110987654321 0 1111111111111111 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w note: accessin g the tddr in 8-bit units is prohibited. always access in 16-bit units. 10.3.26 timer cycle data register (tcdr) tcdr is a 16-bit register used only in complementary pwm mode. set half the pwm carrier sync value as the tcdr register value. this register is constantly compared with the tcnts counter in complementary pwm mode, and when a match occurs, the tcnts counter switches direction (decrement to increment). the initial value of tcdr is h'ffff. bit: initial value: r/w: 151413121110987654321 0 1111111111111111 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w note: accessin g the tcdr in 8-bit units is prohibited. always access in 16-bit units.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 324 of 1080 rej09b0230-0300 10.3.27 timer cycle buffer register (tcbr) tcbr is a 16-bit register used only in complementary pwm mode. it functions as a buffer register for the tcdr register. the tcbr register values are transferred to the tcdr register with the transfer timing set in the tmdr register. the initial value of tcbr is h'ffff. bit: initial value: r/w: 151413121110987654321 0 1111111111111111 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w note: accessin g the tcbr in 8-bit units is prohibited. always access in 16-bit units. 10.3.28 timer interrupt skipping set register (titcr) titcr is an 8-bit readable/writable register that enables or disables interrupt skipping and specifies the interrupt skipping count. the mtu2 has one titcr. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w t3aen 3acor[2:0] t4ven 4vcor[2:0] bit bit name initial value r/w description 7 t3aen 0 r/w t3aen enables or disables tgia_3 interrupt skipping. 0: tgia_3 interrupt skipping disabled 1: tgia_3 interrupt skipping enabled 6 to 4 3acor[2:0] 000 r/w these bits specify the tgia_3 interrupt skipping count within the range from 0 to 7. * for details, see table 10.43. 3 t4ven 0 r/w t4ven enables or disables tciv_4 interrupt skipping. 0: tciv_4 interrupt skipping disabled 1: tciv_4 interrupt skipping enabled
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 325 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 to 0 4vcor[2:0] 000 r/w these bits specify the tciv_4 interrupt skipping count within the range from 0 to 7. * for details, see table 10.44. note: * when 0 is specified for the interrupt skipping count, no interrupt skipping will be performed. before changing the interrupt skipping count, be sure to clear the t3aen and t4ven bits to 0 to clear the skipping counter (titcnt). table 10.43 setting of interrupt skipping count by bits 3acor2 to 3acor0 bit 6 bit 5 bit 4 3acor2 3acor1 3acor0 description 0 0 0 does not skip tgia_3 interrupts. 0 0 1 sets the tgia_3 interrupt skipping count to 1. 0 1 0 sets the tgia_3 interrupt skipping count to 2. 0 1 1 sets the tgia_3 interrupt skipping count to 3. 1 0 0 sets the tgia_3 interrupt skipping count to 4. 1 0 1 sets the tgia_3 interrupt skipping count to 5. 1 1 0 sets the tgia_3 interrupt skipping count to 6. 1 1 1 sets the tgia_3 interrupt skipping count to 7. table 10.44 setting of interrupt skipping count by bits 4vcor2 to 4vcor0 bit 2 bit 1 bit 0 4vcor2 4vcor1 4vcor0 description 0 0 0 does not skip tciv_4 interrupts. 0 0 1 sets the tciv_4 interrupt skipping count to 1. 0 1 0 sets the tciv_4 interrupt skipping count to 2. 0 1 1 sets the tciv_4 interrupt skipping count to 3. 1 0 0 sets the tciv_4 interrupt skipping count to 4. 1 0 1 sets the tciv_4 interrupt skipping count to 5. 1 1 0 sets the tciv_4 interrupt skipping count to 6. 1 1 1 sets the tciv_4 interrupt skipping count to 7.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 326 of 1080 rej09b0230-0300 10.3.29 timer interrupt skipping counter (titcnt) titcnt is an 8-bit readable/writable counter. the mtu2 has one titcnt. titcnt retains its value even after stopping the count operation of tcnt_3 and tcnt_4. bit: initial value: r/w: 7654321 0 00000000 rrrrrrrr - 3acnt[2:0] - 4vcnt[2:0] bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0. 6 to 4 3acnt[2:0] 000 r tgia_3 interrupt counter while the t3aen bit in titcr is set to 1, the count in these bits is incremented every time a tgia_3 interrupt occurs. [clearing conditions] ? when the 3acnt2 to 3acnt0 value in titcnt matches the 3acor2 to 3acor0 value in titcr ? when the t3aen bit in titcr is cleared to 0 ? when the 3acor2 to 3acor0 bits in titcr are cleared to 0 3 ? 0 r reserved this bit is always read as 0. 2 to 0 4vcnt[2:0] 000 r tciv_4 interrupt counter while the t4ven bit in titcr is set to 1, the count in these bits is incremented every time a tciv_4 interrupt occurs. [clearing conditions] ? when the 4vcnt2 to 4vcnt0 value in titcnt matches the 4vcor2 to 4vcor2 value in titcr ? when the t4ven bit in titcr is cleared to 0 ? when the 4vcor2 to 4vcor2 bits in titcr are cleared to 0 note: to clear the titcnt, clear the t3aen and t4ven bits in titcr to 0.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 327 of 1080 rej09b0230-0300 10.3.30 timer buffer transfer set register (tbter) tbter is an 8-bit readable/writable register that enables or disables transfer from the buffer registers* used in complementary pwm mode to the temporary registers and specifies whether to link the transfer with interrupt skipping operation. the mtu2 has one tbter. bit: initial value: r/w: 7654321 0 00000000 rrrrrrr/wr/w - - - - - - bte[1:0] bit bit name initial value r/w description 7 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1, 0 bte[1:0] 00 r/w these bits enable or disable transfer from the buffer registers * used in complementary pwm mode to the temporary registers and specify whether to link the transfer with interrupt skipping operation. for details, see table 10.45. note: * applicable buffer registers: tgrc_3, tgrd_3, tgrc_4, tgrd_4, and tcbr
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 328 of 1080 rej09b0230-0300 table 10.45 setting of bits bte1 and bte0 bit 1 bit 0 bte1 bte0 description 0 0 enables transfer from the buffer registers to the temporary registers * 1 and does not link the transfer with interrupt skipping operation. 0 1 disables transfer from the buffer registers to the temporary registers. 1 0 links transfer from the buffer registers to the temporary registers with interrupt skipping operation. * 2 1 1 setting prohibited notes: 1. data is transferred according to the md3 to md0 bit setting in tmdr. for details, refer to section 10.4.8, complementary pwm mode. 2. when interrupt skipping is disabled (the t3aen and t4ven bits are cleared to 0 in the timer interrupt skipping set register (titcr) or the skipping count set bits (3acor and 4vcor) in titcr are cleared to 0)), be sure to disable link of buffer transfer with interrupt skipping (clear the bte1 bit in the timer buffer transfer set register (tbter) to 0). if link with interrupt skipping is enabled while interrupt skipping is disabled, buffer transfer will not be performed.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 329 of 1080 rej09b0230-0300 10.3.31 timer dead time enable register (tder) tder is an 8-bit readable/writable register that controls dead time generation in complementary pwm mode. the mtu2 has one tder in channel 3. tder must be modified only while tcnt stops. bit: initial value: r/w: 7654321 0 00000001 rrrrrrrr/(w) -------tder bit bit name initial value r/w description 7 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 tder 1 r/(w) dead time enable specifies whether to generate dead time. 0: does not generate dead time 1: generates dead time * [clearing condition] ? when 0 is written to tder after reading tder = 1 note: * tddr must be set to 1 or a larger value.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 330 of 1080 rej09b0230-0300 10.3.32 timer waveform control register (twcr) twcr is an 8-bit readable/writable register that controls the waveform when synchronous counter clearing occurs in tcnt_3 and tcnt_4 in complementary pwm mode and specifies whether to clear the counters at tgra_3 compare match. the cce bit and wre bit in twcr must be modified only while tcnt stops. bit: initial value: r/w: 7654321 0 note: do not set to 1 when complementary pwm mode is not selected. * 0 * 0000000 r/(w) r r r r r r/(w) r/(w) cce-----sccwre bit bit name initial value r/w description 7 cce 0 * r/(w) compare match clear enable specifies whether to clear counters at tgra_3 compare match in complementary pwm mode. 0: does not clear counters at tgra_3 compare match 1: clears counters at tgra_3 compare match [setting condition] ? when 1 is written to cce after reading cce = 0 6 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 331 of 1080 rej09b0230-0300 bit bit name initial value r/w description 1 scc 0 r/(w) synchronous clearing control specifies whether to clear tcnt_3 and tcnt_4 in the mtu2s when synchronous counter clearing between the mtu2 and mtu2s occurs in complementary pwm mode. when using this control, place the mtu2s in complementary pwm mode. when modifying the scc bit while the counters are operating, do not modify the cce or wre bits. counter clearing synchronized with the mtu2 is disabled by the scc bit setting only when synchronous clearing occurs outside the tb interval at the trough. when synchronous clearing occurs in the tb interval at the trough including the period immediately after tcnt_3 and tcnt_4 start operation, tcnt_3 and tcnt_4 in the mtu2s are cleared. for the tb interval at the trough in complementary pwm mode, see figure 10.41. in the mtu2, this bit is reserved. it is always read as 0 and the write value should always be 0. 0: enables clearing of tcnt_3 and tcnt_4 in the mtu2s by mtu2?mtu2s synchronous clearing operation 1: disables clearing of tcnt_3 and tcnt_4 in the mtu2s by mtu2?mtu2s synchronous clearing operation [setting condition] ? when 1 is written to scc after reading scc = 0
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 332 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 wre 0 r/(w) waveform retain enable selects the waveform output when synchronous counter clearing occurs in complementary pwm mode. the output waveform is retained only when synchronous clearing occurs within the tb interval at the trough in complementary pwm mode. when synchronous clearing occurs outside this interval, the initial value specified in tocr is output regardless of the wre bit setting. the initial value is also output when synchronous clearing occurs in the tb interval at the trough immediately after tcnt_3 and tcnt_4 start operation. for the tb interval at the trough in complementary pwm mode, see figure 10.41. 0: outputs the initial value specified in tocr 1: retains the waveform output immediately before synchronous clearing [setting condition] ? when 1 is written to wre after reading wre = 0 note: * do not set to 1 when complementary pwm mode is not selected. 10.3.33 bus master interface the timer counters (tcnt), general registers (t gr), timer subcounter (tcnts), timer cycle buffer register (tcbr), timer dead time data register (tddr), timer cycle data register (tcdr), timer a/d converter start request control register (tadcr), timer a/d converter start request cycle set registers (tadcor), and timer a/d conve rter start request cycle set buffer registers (tadcobr) are 16-bit registers. a 16-bit data bus to the bus master enables 16-bit read/writes. 8- bit read/write is not possible. always access in 16-bit units. all registers other than the above registers are 8- bit registers. these are connected to the cpu by a 16-bit data bus, so 16-bit read/writes and 8-bit read/writes are both possible.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 333 of 1080 rej09b0230-0300 10.4 operation 10.4.1 basic functions each channel has a tcnt and tgr register. tcnt performs up-counting, and is also capable of free-running operation, cycle counting, and external event counting. each tgr can be used as an input capture register or output compare register. always select mtu2 external pins set function using the pin function controller (pfc). counter operation: when one of bits cst0 to cst4 in tstr or bits cstu5, cstv5, and cstw5 in tstr_5 is set to 1, the tcnt counter for the corresponding ch annel begins counting. tcnt can operate as a free-running counter, periodic counter, for example. 1. example of count operation setting procedure figure 10.5 shows an example of th e count operation setting procedure. operation selection select counter clock periodic counter select counter clearin g source select output compare re g ister set period free-runnin g counter start count operation start count operation [1] [2] [3] [4] [5] [5] [1] select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock ed g e with bits ckeg1 and ckeg0 in tcr. [2] for periodic counter operation, select the tgr to be used as the tcnt clearin g source with bits cclr2 to cclr0 in tcr. [3] desi g nate the tgr selected in [2] as an output compare re g ister by means of tior. [4] set the periodic counter cycle in the tgr selected in [2]. [5] set the cst bit in tstr to 1 to start the counter operation. figure 10.5 example of count er operation setting procedure
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 334 of 1080 rej09b0230-0300 2. free-running count operation and periodic count operation: immediately after a reset, the mtu2?s tcnt counters are all designated as free-running counters. when the relevant bit in tstr is set to 1 the corresponding tcnt counter starts up- count operation as a free-running counter. when tcnt overflows (from h'ffff to h'0000), the tcfv bit in tsr is set to 1. if the value of the corresponding tciev bit in tier is 1 at this point, the mtu2 requests an interrupt. after overflow, tcnt starts counting up again from h'0000. figure 10.6 illustrates free-running counter operation. tcnt value h'ffff h'0000 cst bit tcfv time figure 10.6 free-running counter operation when compare match is selected as the tcnt clearing source, the tcnt counter for the relevant channel performs periodic count operation. the tgr register for setting the period is designated as an output compare register, and counter clearing by compare match is selected by means of bits cclr0 to cclr2 in tcr. afte r the settings have been made, tcnt starts up-count operation as a periodic counter when the corresponding bit in tstr is set to 1. when the count value matches the value in tgr, the tgf bit in tsr is set to 1 and tcnt is cleared to h'0000. if the value of the corresponding tgie bit in tier is 1 at this point, the mtu2 requests an interrupt. after a compare match, tcnt starts counting up again from h'0000.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 335 of 1080 rej09b0230-0300 figure 10.7 illustrates peri odic counter operation. tcnt value tgr h'0000 cst bit tgf time counter cleared by tgr compare match fla g cleared by software or dtc activation figure 10.7 period ic counter operation waveform output by compare match: the mtu2 can perform 0, 1, or toggle output from the corresponding output pin using compare match. 1. example of setting procedure for waveform output by compare match figure 10.8 shows an example of the setting procedure for waveform output by compare match output selection select waveform output mode set output timin g start count operation [1] [2] [3] [1] select initial value 0 output or 1 output, and compare match output value 0 output, 1 output, or to gg le output, by means of tior. the set initial value is output at the tioc pin until the first compare match occurs. [2] set the timin g for compare match g eneration in tgr. [3] set the cst bit in tstr to 1 to start the count operation. figure 10.8 example of setting procedure for waveform output by compare match
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 336 of 1080 rej09b0230-0300 2. examples of waveform output operation: figure 10.9 shows an example of 0 output/1 output. in this example tcnt has been designated as a free-running counter, a nd settings have been made such that 1 is output by compare match a, and 0 is output by compare match b. when the set level and the pin level coincide, the pin level does not change. tcnt value h'ffff h'0000 tioca tiocb time tgra tgrb no chan g e no chan g e no chan g e no chan g e 1 output 0 output figure 10.9 example of 0 output/1 output operation figure 10.10 shows an example of toggle output. in this example, tcnt has been designated as a periodic counter (with counter clearing on compare match b), and settings have been made such that the output is toggled by both compare match a and compare match b. tcnt value h'ffff h'0000 tiocb tioca time tgrb tgra to gg le output to gg le output counter cleared by tgrb compare match figure 10.10 example of toggle output operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 337 of 1080 rej09b0230-0300 input capture function: the tcnt value can be transferred to tgr on detection of the tioc pin input edge. rising edge, falling edge, or both edges can be select ed as the detected edge. for channels 0 and 1, it is also possible to specify another channel's counter input clock or compare match signal as the input capture source. note: when another channel's counter input clock is used as the input capture input for channels 0 and 1, mp /1 should not be selected as the counter input clock used for input capture input. input capture will not be generated if mp /1 is selected. 1. example of input capture operation setting procedure figure 10.11 shows an example of the input capture operation setting procedure. input selection select input capture input start count [1] [2] [1] desi g nate tgr as an input capture re g ister by means of tior, and select risin g ed g e, fallin g ed g e, or both ed g es as the input capture source and input si g nal ed g e. [2] set the cst bit in tstr to 1 to start the count operation. figure 10.11 example of input capture operation setting procedure
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 338 of 1080 rej09b0230-0300 2. example of input capture operation: figure 10.12 shows an example of input capture operation. in this example both rising and falling edges have been selected as the tioca pin input capture input edge, the falling edge has been se lected as the tiocb pi n input capture input edge, and counter clearing by tgrb input capture has been designated for tcnt. tcnt value h'0180 h'0000 tioca tgra h'0010 h'0005 counter cleared by tiocb input (fallin g ed g e) h'0160 h'0005 h'0160 h'0010 tgrb h'0180 tiocb time figure 10.12 example of input capture operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 339 of 1080 rej09b0230-0300 10.4.2 synchronous operation in synchronous operation, the values in a number of tcnt counters can be rewritten simultaneously (synchronous presetting). also, a number of tcnt counters can be cleared simultaneously by making the appropriate setting in tcr (synchronous clearing). synchronous operation enables tgr to be incremented with respect to a single time base. channels 0 to 4 can all be designated for synchr onous operation. channel 5 cannot be used for synchronous operation. example of synchronous operation setting procedure: figure 10.13 shows an example of the synchronous operation setting procedure. no yes set synchronous operation clearin g source g eneration channel? select counter clearin g source start count set synchronous counter clearin g start count [1] [3] [5] [4] [5] [2] synchronous operation selection [1] set to 1 the sync bits in tsyr correspondin g to the channels to be desi g nated for synchronous operation. [2] when the tcnt counter of any of the channels desi g nated for synchronous operation is written to, the same value is simultaneously written to the other tcnt counters. [3] use bits cclr2 to cclr0 in tcr to specify tcnt clearin g by input capture/output compare, etc. [4] use bits cclr2 to cclr0 in tcr to desi g nate synchronous clearin g for the counter clearin g source. [5] set to 1 the cst bits in tstr for the relevant channels, to start the count operation. set tcnt synchronous presettin g synchronous clearin g figure 10.13 example of synchronous operation setting procedure
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 340 of 1080 rej09b0230-0300 example of synchronous operation: figure 10.14 shows an example of synchronous operation. in this example, synchronous operation and pwm m ode 1 have been designated for channels 0 to 2, tgrb_0 compare match has been set as the channel 0 counter clearing source, and synchronous clearing has been set for the channel 1 and 2 counter clearing source. three-phase pwm waveforms are output from pins tioc0a, tioc1a, and tioc2a. at this time, synchronous presetting, and synchron ous clearing by tgrb_0 compare match, are performed for channel 0 to 2 tcnt counters, and the data set in tgrb_0 is used as the pwm cycle. for details of pwm modes, see section 10.4.5, pwm modes. tcnt_0 to tcnt_2 values h'0000 tioc0a tioc1a tgrb_0 synchronous clearin g by tgrb_0 compare match tgra_2 tgra_1 tgrb_2 tgra_0 tgrb_1 tioc2a time figure 10.14 example of synchronous operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 341 of 1080 rej09b0230-0300 10.4.3 buffer operation buffer operation, provided for channels 0, 3, and 4, enables tgrc and tgrd to be used as buffer registers. in channel 0, tgrf can also be used as a buffer register. buffer operation differs depending on whether tgr has been designated as an input capture register or as a compare match register. note: tgre_0 cannot be designated as an input capture register and can only operate as a compare match register. table 10.46 shows the register combinations used in buffer operation. table 10.46 register combinat ions in buffer operation channel timer general re gister buffer register 0 tgra_0 tgrc_0 tgrb_0 tgrd_0 tgre_0 tgrf_0 3 tgra_3 tgrc_3 tgrb_3 tgrd_3 4 tgra_4 tgrc_4 tgrb_4 tgrd_4 ? when tgr is an output compare register when a compare match occurs, the value in the buffer register for the corresponding channel is transferred to the timer general register. this operation is illustrated in figure 10.15. buffer re g ister timer g eneral re g ister tcnt comparator compare match si g nal figure 10.15 compare match buffer operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 342 of 1080 rej09b0230-0300 ? when tgr is an input capture register when input capture occurs, the value in tcnt is transferred to tgr and the value previously held in the timer general register is transferred to the buffer register. this operation is illustrated in figure 10.16. buffer re g ister timer g eneral re g ister tcnt input capture si g nal figure 10.16 input capture buffer operation example of buffer operati on setting procedure: figure 10.17 shows an example of the buffer operation setting procedure. buffer operation select tgr function set buffer operation start count [1] [2] [3] [1] desi g nate tgr as an input capture re g ister or output compare re g ister by means of tior. [2] desi g nate tgr for buffer operation with bits bfa and bfb in tmdr. [3] set the cst bit in tstr to 1 start the count operation. figure 10.17 example of buff er operation setting procedure
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 343 of 1080 rej09b0230-0300 examples of bu ffer operation: 1. when tgr is an output compare register figure 10.18 shows an operation example in which pwm mode 1 has been designated for channel 0, and buffer operation has been desi gnated for tgra and tgrc. the settings used in this example are tcnt clearing by compare match b, 1 output at compare match a, and 0 output at compare match b. in this example, the ttsa bit in tbtm is cleared to 0. as buffer operation has been se t, when compare match a occurs the output changes and the value in buffer register tgrc is simultaneously transferred to timer general register tgra. this operation is repeated each tim e that compare match a occurs. for details of pwm modes, see section 10.4.5, pwm modes. tcnt value tgrb_0 h'0000 tgrc_0 tgra_0 h'0200 h'0520 tioca h'0200 h'0450 h'0520 h'0450 tgra_0 h'0450 h'0200 transfer time figure 10.18 example of buffer operation (1) 2. when tgr is an input capture register figure 10.19 shows an operation example in which tgra has been designated as an input capture register, and buffer operation has been designated for tgra and tgrc. counter clearing by tgra input capture has been set for tcnt, and both rising and falling edges have been selected as the tioca pin input capture input edge. as buffer operation has been set, when the tcnt value is stored in tgra upon the occurrence of input capture a, the value previously stored in tgra is simultaneously transferred to tgrc.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 344 of 1080 rej09b0230-0300 tcnt value h'09fb h'0000 tgrc time h'0532 tioca tgra h'0f07 h'0532 h'0f07 h'0532 h'0f07 h'09fb figure 10.19 example of buffer operation (2) selecting timing for transfer from buffer regi sters to timer general registers in buffer operation: the timing for transfer from buffer register s to timer general registers can be selected in pwm mode 1 or 2 for channel 0 or in pwm mode 1 for channels 3 and 4 by setting the buffer operation transfer mode registers (tbtm_0, tbtm_3, and tbtm_4). either compare match (initial setting) or tcnt clearing can be select ed for the transfer timing. tcnt clearing as transfer timing is one of the following cases. ? when tcnt overflows (h'ffff to h'0000) ? when h'0000 is written to tcnt during counting ? when tcnt is cleared to h'0000 under the cond ition specified in the cclr2 to cclr0 bits in tcr note: tbtm must be modified only while tcnt stops. figure 10.20 shows an operation example in which pwm mode 1 is designated for channel 0 and buffer operation is designated for tgra_0 and tgrc_0. the settings used in this example are tcnt_0 clearing by compare match b, 1 output at compare match a, and 0 output at compare match b. the ttsa bit in tbtm_0 is set to 1.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 345 of 1080 rej09b0230-0300 tcnt_0 value h'0000 tgra_0 time tioca tgrc_0 h'0520 h'0520 h'0450 h'0450 h'0200 h'0520 h'0450 h'0200 h'0200 tgrb_0 tgra_0 transfer figure 10.20 example of buffer operation when tcnt_0 clearing is selected for tgrc_0 to tgra_0 transfer timing 10.4.4 cascaded operation in cascaded operation, two 16-bit counters for different channels are used together as a 32-bit counter. this function works by counting the channel 1 counter clock upon overflow/underflow of tcnt_2 as set in bits tp sc0 to tpsc2 in tcr. underflow occurs only when the lower 16-bit tcnt is in phase-counting mode. table 10.47 shows the register combinations used in cascaded operation. note: when phase counting mode is set for channel 1, the counter clock setting is invalid and the counters operates independently in phase counting mode. table 10.47 cascaded combinations combination upper 16 bits lower 16 bits channels 1 and 2 tcnt_1 tcnt_2 for simultaneous input capture of tcnt_1 and tcnt_2 during cascaded operation, additional input capture input pins can be specified by the input capture control register (ticcr). for input capture in cascade connection, refer to section 10.7.22, simultaneous capture of tcnt_1 and tcnt_2 in cascade connection.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 346 of 1080 rej09b0230-0300 table 10.48 shows the ticcr setting and input capture input pins. table 10.48 ticcr setting and input capture input pins target input capture ticcr setting input capture input pins i2ae bit = 0 (initial value) tioc1a input capture from tcnt_1 to tgra_1 i2ae bit = 1 tioc1a, tioc2a i2be bit = 0 (initial value) tioc1b input capture from tcnt_1 to tgrb_1 i2be bit = 1 tioc1b, tioc2b i1ae bit = 0 (initial value) tioc2a input capture from tcnt_2 to tgra_2 i1ae bit = 1 tioc2a, tioc1a i1be bit = 0 (initial value) tioc2b input capture from tcnt_2 to tgrb_2 i1be bit = 1 tioc2b, tioc1b example of cascaded operation setting procedure: figure 10.21 shows an example of the setting procedure for cascaded operation. cascaded operation set cascadin g start count [1] [2] [1] set bits tpsc2 to tpsc0 in the channel 1 tcr to b'1111 to select tcnt_2 overflow/ underflow countin g . [2] set the cst bit in tstr for the upper and lower channel to 1 to start the count operation. figure 10.21 cascaded op eration setting procedure cascaded operation example (a): figure 10.22 illustrates the operation when tcnt_2 overflow/underflow counting has been set for tcnt_1 and phase counting mode has been designated for channel 2. tcnt_1 is incremented by tcnt_2 overflow and decremented by tcnt_2 underflow.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 347 of 1080 rej09b0230-0300 tclkc tcnt_2 fffd tcnt_1 0001 tclkd fffe ffff 0000 0001 0002 0001 0000 ffff 0000 0000 figure 10.22 cascaded operation example (a) cascaded operation example (b): figure 10.23 illustrates the operation when tcnt_1 and tcnt_2 have been cascaded and the i2ae bit in ticcr has been set to 1 to include the tioc2a pin in the tgra_1 input capture conditions. in this example, the ioa0 to ioa3 bits in tior_1 have selected the tioc1a rising edge for the input capture timing while the ioa0 to ioa3 bits in tior_2 have selected the tioc2a rising edge for the input capture timing. under these conditions, the rising edge of both tioc1a and tioc2a is used for the tgra_1 input capture condition. for the tgra_2 input captu re condition, the tioc2a rising edge is used. tcnt_2 value h'0000 tgra_1 tgra_2 time tioc1a tioc2a tcnt_1 h'0514 h'0513 h'0512 h'0513 h'0512 h'c256 h'c256 h'ffff h'6128 as i1ae in ticcr is 0, data is not captured in tgra_2 at the tioc1a input timin g . figure 10.23 cascaded operation example (b)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 348 of 1080 rej09b0230-0300 cascaded operation example (c): figure 10.24 illustrates the operation when tcnt_1 and tcnt_2 have been cascaded and the i2ae and i1ae bits in ticcr have been set to 1 to include the tioc2a and tioc1a pins in the tg ra_1 and tgra_2 input capture conditions, respectively. in this example, the ioa0 to ioa3 bits in both tior_1 and tior_2 have selected both the rising and falling edges for the input capture timing. under these conditions, the ored result of tioc1a and tioc2a input is used for the tgra_1 and tgra_2 input capture conditions. tcnt_2 value h'0000 tgra_1 tgra_2 time tioc1a tioc2a tcnt_1 h'0514 h'0514 h'0513 h'0512 h'0513 h'0512 h'c256 h'c256 h'ffff h'6128 h'6128 h'2064 h'2064 h'9192 h'9192 figure 10.24 cascaded operation example (c) cascaded operation example (d): figure 10.25 illustrates the operation when tcnt_1 and tcnt_2 have been cascaded and the i2ae bit in ticcr has been set to 1 to include the tioc2a pin in the tgra_1 input capture conditions. in this example, the ioa0 to ioa3 bits in tior_1 have selected tgra_0 compare match or input capture occurrence for the input capture timing while the ioa0 to ioa3 bits in tior_2 have selected the tioc2a rising edge for the input capture timing. under these conditions, as tior_1 has selected tgra_0 compare match or input capture occurrence for the input capture timing, the tioc2a edge is not used for tgra_1 input capture condition although the i2ae bit in ticcr has been set to 1.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 349 of 1080 rej09b0230-0300 tcnt_2 value h'0000 h'0000 tgra_1 tgra_2 time tioc1a tioc2a tcnt_1 h'0513 h'0512 h'0513 h'd000 h'ffff h'd000 tcnt_0 value time tgra_0 compare match between tcnt_0 and tgra_0 figure 10.25 cascaded operation example (d)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 350 of 1080 rej09b0230-0300 10.4.5 pwm modes in pwm mode, pwm waveforms are output from the output pins. the output level can be selected as 0, 1, or toggle output in response to a compare match of each tgr. tgr registers settings can be used to output a pwm waveform in the range of 0% to 100% duty. designating tgr compare match as the counter clearing source enables the period to be set in that register. all channels can be designated for pw m mode independently. synchronous operation is also possible. there are two pwm modes, as described below. 1. pwm mode 1 pwm output is generated from the tioca and tiocc pins by pairing tgra with tgrb and tgrc with tgrd. the output specified by bits ioa0 to ioa3 and ioc0 to ioc3 in tior is output from the tioca and tiocc pins at compare matches a and c, and the output specified by bits iob0 to iob3 and iod0 to iod3 in tior is output at compare matches b and d. the initial output value is the value set in tgra or tgrc. if the set values of paired tgrs are identical, the output value does not change when a compare match occurs. in pwm mode 1, a maximum 8-phase pwm output is possible. 2. pwm mode 2 pwm output is generated using one tgr as the cycle register and the others as duty registers. the output specified in tior is performed by means of compare matches. upon counter clearing by a synchronization register compare match, the output value of each pin is the initial value set in tior. if the set values of the cy cle and duty registers are identical, the output value does not change when a compare match occurs. in pwm mode 2, a maximum 8-phase pwm output is possible in combination use with synchronous operation. the correspondence between pwm output pins and registers is shown in table 10.49.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 351 of 1080 rej09b0230-0300 table 10.49 pwm output registers and output pins output pins channel registers pwm mode 1 pwm mode 2 tgra_0 tioc0a tgrb_0 tioc0a tioc0b tgrc_0 tioc0c 0 tgrd_0 tioc0c tioc0d tgra_1 tioc1a 1 tgrb_1 tioc1a tioc1b tgra_2 tioc2a 2 tgrb_2 tioc2a tioc2b tgra_3 cannot be set tgrb_3 tioc3a cannot be set tgrc_3 cannot be set 3 tgrd_3 tioc3c cannot be set tgra_4 cannot be set tgrb_4 tioc4a cannot be set 4 tgrc_4 tioc4c cannot be set tgrd_4 cannot be set note: in pwm mode 2, pwm output is not possible for the tgr register in which the period is set.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 352 of 1080 rej09b0230-0300 example of pwm mode setting procedure: figure 10.26 shows an example of the pwm mode setting procedure. pwm mode select counter clock select counter clearin g source select waveform output level set tgr set pwm mode start count [1] [2] [3] [4] [5] [6] [1] select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock ed g e with bits ckeg1 and ckeg0 in tcr. [2] use bits cclr2 to cclr0 in tcr to select the tgr to be used as the tcnt clearin g source. [3] use tior to desi g nate the tgr as an output compare re g ister, and select the initial value and output value. [4] set the cycle in the tgr selected in [2], and set the duty in the other tgr. [5] select the pwm mode with bits md3 to md0 in tmdr. [6] set the cst bit in tstr to 1 to start the count operation. figure 10.26 example of pwm mode setting procedure examples of pwm mode operation: figure 10.27 shows an example of pwm mode 1 operation. in this example, tgra compare match is set as the tcnt clearing source, 0 is set for the tgra initial output value and output value, and 1 is set as the tgrb output value. in this case, the value set in tgra is used as th e period, and the values set in the tgrb registers are used as the duty levels.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 353 of 1080 rej09b0230-0300 tcnt value tgra h'0000 tioca time tgrb counter cleared by tgra compare match figure 10.27 example of pwm mode operation (1) figure 10.28 shows an example of pwm mode 2 operation. in this example, synchronous operation is designated for channels 0 and 1, tgrb_1 compare match is set as the tcnt clearing source, and 0 is set for the initial output value and 1 for the output value of the other tgr registers (tgra_0 to tgrd_0, tgra_1), outputting a 5-phase pwm waveform. in this case, the value set in tgrb_1 is used as th e cycle, and the values set in the other tgrs are used as the duty levels. tcnt value tgrb_1 h'0000 tioc0a counter cleared by tgrb_1 compare match time tgra_1 tgrd_0 tgrc_0 tgrb_0 tgra_0 tioc0b tioc0c tioc0d tioc1a figure 10.28 example of pwm mode operation (2)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 354 of 1080 rej09b0230-0300 figure 10.29 shows examples of pwm waveform output with 0% duty and 100% duty in pwm mode. tcnt value tgra h'0000 tioca time tgrb 0% duty tgrb rewritten tgrb rewritten tgrb rewritten tcnt value tgra h'0000 tioca time tgrb 100% duty tgrb rewritten tgrb rewritten tgrb rewritten output does not chan g e when cycle re g ister and duty re g ister compare matches occur simultaneously tcnt value tgra h'0000 tioca time tgrb 100% duty tgrb rewritten tgrb rewritten tgrb rewritten output does not chan g e when cycle re g ister and duty re g ister compare matches occur simultaneously 0% duty figure 10.29 example of pwm mode operation (3)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 355 of 1080 rej09b0230-0300 10.4.6 phase counting mode in phase counting mode, the phase difference between two external clock inputs is detected and tcnt is incremented/d ecremented accordingly. this mode can be set for channels 1 and 2. when phase counting mode is set, an external cl ock is selected as the counter input clock and tcnt operates as an up/down-counter regardless of the setting of bits tpsc0 to tpsc2 and bits ckeg0 and ckeg1 in tcr. however, the functions of bits cclr0 and cclr1 in tcr, and of tior, tier, and tgr, are valid, and input capture/compare match and interrupt functions can be used. this can be used for two-phase encoder pulse input. if overflow occurs when tcnt is counting up, the tcfv flag in tsr is set; if underflow occurs when tcnt is counting down, the tcfu flag is set. the tcfd bit in tsr is the count direction flag. reading the tcfd flag reveals whether tcnt is counting up or down. table 10.50 shows the correspondence between external clock pins and channels. table 10.50 phase counting mode clock input pins external clock pins channels a-phase b-phase when channel 1 is set to phase counting mode tclka tclkb when channel 2 is set to phase counting mode tclkc tclkd example of phase counting mode setting procedure: figure 10.30 shows an example of the phase counting mode setting procedure. phase countin g mode select phase countin g mode start count [1] [2] [1] select phase countin g mode with bits md3 to md0 in tmdr. [2] set the cst bit in tstr to 1 to start the count operation. figure 10.30 example of phase counting mode setting procedure
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 356 of 1080 rej09b0230-0300 examples of phase counting mode operation: in phase counting mode, tcnt counts up or down according to the phase difference between tw o external clocks. there are four modes, according to the count conditions. 1. phase counting mode 1 figure 10.31 shows an example of phase counting mode 1 operation, and table 10.51 summarizes the tcnt up/down-count conditions. tcnt value time tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) up-count down-count figure 10.31 example of phase counting mode 1 operation table 10.51 up/down-count conditions in phase counting mode 1 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level up-count low level low level high level high level down-count low level high level low level [legend] : rising edge : falling edge
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 357 of 1080 rej09b0230-0300 2. phase counting mode 2 figure 10.32 shows an example of phase counting mode 2 operation, and table 10.52 summarizes the tcnt up/down-count conditions. time down-count up-count tcnt value tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) figure 10.32 example of phase counting mode 2 operation table 10.52 up/down-count conditions in phase counting mode 2 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level don't care low level don't care low level don't care high level up-count high level don't care low level don't care high level don't care low level down-count [legend] : rising edge : falling edge
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 358 of 1080 rej09b0230-0300 3. phase counting mode 3 figure 10.33 shows an example of phase counting mode 3 operation, and table 10.53 summarizes the tcnt up/down-count conditions. time up-count down-count tcnt value tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) figure 10.33 example of phase counting mode 3 operation table 10.53 up/down-count conditions in phase counting mode 3 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level don't care low level don't care low level don't care high level up-count high level down-count low level don't care high level don't care low level don't care [legend] : rising edge : falling edge
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 359 of 1080 rej09b0230-0300 4. phase counting mode 4 figure 10.34 shows an example of phase counting mode 4 operation, and table 10.54 summarizes the tcnt up/down-count conditions. time up-count down-count tcnt value tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) figure 10.34 example of phase counting mode 4 operation table 10.54 up/down-count conditions in phase counting mode 4 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level up-count low level low level don't care high level high level down-count low level high level don't care low level [legend] : rising edge : falling edge
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 360 of 1080 rej09b0230-0300 phase counting mode application example: figure 10.35 shows an example in which channel 1 is in phase counting mode, and channel 1 is coupled with channel 0 to input servo motor 2-phase encoder pulses in order to detect position or speed. channel 1 is set to phase counting mode 1, and the encoder pulse a-phase and b-phase are input to tclka and tclkb. channel 0 operates with tcnt counter clearing by tgrc_0 compare match; tgra_0 and tgrc_0 are used for the compare match function a nd are set with the speed control period and position control period. tgrb_0 is used for input capture, with tgrb_0 and tgrd_0 operating in buffer mode. the channel 1 counter input clock is designated as the tgrb_0 input capture source, and the pulse widths of 2-phase encoder 4-multiplication pulses are detected. tgra_1 and tgrb_1 for channel 1 are designated for input capture, and channel 0 tgra_0 and tgrc_0 compare matches are selected as the input capture source and store the up/down-counter values for the control periods. this procedure enables the accurate detection of position and speed.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 361 of 1080 rej09b0230-0300 tcnt_1 tcnt_0 channel 1 tgra_1 (speed period capture) tgra_0 (speed control period) tgrb_1 (position period capture) tgrc_0 (position control period) tgrb_0 (pulse width capture) tgrd_0 (buffer operation) channel 0 tclka tclkb ed g e detection circuit + - + - figure 10.35 phase counting mode application example
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 362 of 1080 rej09b0230-0300 10.4.7 reset-synchronized pwm mode in the reset-synchronized pwm mode, three-phase output of positive and negative pwm waveforms that share a common wave transition point can be obtained by combining channels 3 and 4. when set for reset-synchronized pwm mode, the tioc3b, tioc3d, tioc4a, tioc4c, tioc4b, and tioc4d pins function as pwm output pins and tcnt3 functions as an upcounter. table 10.55 shows the pwm output pins used. table 10.56 shows the settings of the registers. table 10.55 output pins for reset-synchronized pwm mode channel output pin description 3 tioc3b pwm output pin 1 tioc3d pwm output pin 1' (negative-phase waveform of pwm output 1) 4 tioc4a pwm output pin 2 tioc4c pwm output pin 2' (negative-phase waveform of pwm output 2) tioc4b pwm output pin 3 tioc4d pwm output pin 3' (negative-phase waveform of pwm output 3) table 10.56 register settings for reset-synchronized pwm mode register description of setting tcnt_3 initial setting of h'0000 tcnt_4 initial setting of h'0000 tgra_3 set count cycle for tcnt_3 tgrb_3 sets the turning point for pwm waveform output by the tioc3b and tioc3d pins tgra_4 sets the turning point for pwm waveform output by the tioc4a and tioc4c pins tgrb_4 sets the turning point for pwm waveform output by the tioc4b and tioc4d pins
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 363 of 1080 rej09b0230-0300 procedure for selecting the reset-synchronized pwm mode: figure 10.36 shows an example of procedure for selecting the reset synchronized pwm mode. stop countin g select counter clock and counter clear source set tgr reset-synchronized pwm mode brushless dc motor control settin g set tcnt enable waveform output set reset-synchronized pwm mode pwm cycle output enablin g , pwm output level settin g start count operation reset-synchronized pwm mode [1] clear the cst3 and cst4 bits in the tstr to 0 to halt the countin g of tcnt. the reset-synchronized pwm mode must be set up while tcnt_3 and tcnt_4 are halted. [2] set bits tpsc2 to tpsc0 and ckeg1 and ckeg0 in the tcr_3 to select the counter clock and clock ed g e for channel 3. set bits cclr2 to cclr0 in the tcr_3 to select tgra compare-match as a counter clear source. [3] when performin g brushless dc motor control, set bit bdc in the timer g ate control re g ister (tgcr) and set the feedback si g nal input source and output choppin g or g ate si g nal direct output. [4] reset tcnt_3 and tcnt_4 to h'0000. [5] tgra_3 is the period re g ister. set the waveform period value in tgra_3. set the transition timin g of the pwm output waveforms in tgrb_3, tgra_4, and tgrb_4. set times within the compare-match ran g e of tcnt_3. x tgra_3 (x: set value). [6] select enablin g /disablin g of to gg le output synchronized with the pmw cycle usin g bit psye in the timer output control re g ister (tocr1), and set the pwm output level with bits olsp and olsn. when specifyin g the pwm output level by usin g tolbr as a buffer for tocr2, see fi g ure 10.4. [7] set bits md3 to md0 in tmdr_3 to b'1000 to select the reset-synchronized pwm mode. do not set to tmdr_4. [8] set the enablin g /disablin g of the pwm waveform output pin in toer. [9] set the port control re g ister and the port i/o re g ister. [10] set the cst3 bit in the tstr to 1 to start the count operation. [1] [2] [3] [4] [5] [6] [7] [8] pfc settin g [9] [10] note: the output waveform starts to to gg le operation at the point of tcnt_3 = tgra_3 = x by settin g x = tgra, i.e., cycle = duty. figure 10.36 procedure for selecting reset-synchronized pwm mode
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 364 of 1080 rej09b0230-0300 reset-synchronized pw m mode operation: figure 10.37 shows an example of operation in the reset-synchronized pwm mode. tcnt_3 and tcnt_4 operate as upcounters. the counter is cleared when a tcnt_3 and tgra_3 compare-matc h occurs, and then begins incrementing from h'0000. the pwm output pin output toggles with each oc currence of a tgrb_3, tgra_4, tgrb_4 compare-match, and upon counter clears. tgra_3 tgrb_3 tgrb_4 h'0000 tgra_4 tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d time tcnt_3 and tcnt_4 values figure 10.37 reset-s ynchronized pwm mode operation example (when tocr?s olsn = 1 and olsp = 1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 365 of 1080 rej09b0230-0300 10.4.8 complementary pwm mode in the complementary pwm mode, three-phase output of non-overlapping positive and negative pwm waveforms can be obtained by combining channels 3 and 4. pwm waveforms without non- overlapping interval are also available. in complementary pwm mode, tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d pins function as pwm output pins, the tioc3a pin can be set for toggle output synchronized with the pwm period. tcnt_3 and tcnt_4 function as up/down counters. table 10.57 shows the pwm output pins used. table 10.58 shows the settings of the registers used. a function to directly cut off the pwm output by using an external signal is supported as a port function. table 10.57 output pins for complementary pwm mode channel output pin description 3 tioc3a toggle output synchronized with pwm period (or i/o port) tioc3b pwm output pin 1 tioc3c i/o port * tioc3d pwm output pin 1' (non-overlapping negative-phase waveform of pwm output 1; pwm output without non-overlapping interval is also available) 4 tioc4a pwm output pin 2 tioc4b pwm output pin 3 tioc4c pwm output pin 2' (non-overlapping negative-phase waveform of pwm output 2; pwm output without non-overlapping interval is also available) tioc4d pwm output pin 3' (non-overlapping negative-phase waveform of pwm output 3; pwm output without non-overlapping interval is also available) note: * avoid setting the tioc3c pin as a timer i/o pin in the complementary pwm mode.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 366 of 1080 rej09b0230-0300 table 10.58 register settings for complementary pwm mode channel counter/register description read/write from cpu 3 tcnt_3 start of up-count from value set in dead time register maskable by trwer setting * tgra_3 set tcnt_3 upper limit value (1/2 carrier cycle + dead time) maskable by trwer setting * tgrb_3 pwm output 1 compare register maskable by trwer setting * tgrc_3 tgra_3 buffer register always readable/writable tgrd_3 pwm output 1/tgrb_3 buffer register always readable/writable 4 tcnt_4 up-count start, initialized to h'0000 maskable by trwer setting * tgra_4 pwm output 2 compare register maskable by trwer setting * tgrb_4 pwm output 3 compare register maskable by trwer setting * tgrc_4 pwm output 2/tgra_4 buffer register always readable/writable tgrd_4 pwm output 3/tgrb_4 buffer register always readable/writable timer dead time data register (tddr) set tcnt_4 and tcnt_3 offset value (dead time value) maskable by trwer setting * timer cycle data register (tcdr) set tcnt_4 upper limit value (1/2 carrier cycle) maskable by trwer setting * timer cycle buffer register (tcbr) tcdr buffer register always readable/writable subcounter (tcnts) subcounter for dead time generation read-only temporary register 1 (temp1) pwm output 1/tgrb_3 temporary register not readable/writable temporary register 2 (temp2) pwm output 2/tgra_4 temporary register not readable/writable temporary register 3 (temp3) pwm output 3/tgrb_4 temporary register not readable/writable note: * access can be enabled or disabled according to the setting of bit 0 (rwe) in trwer (timer read/write enable register).
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 367 of 1080 rej09b0230-0300 tgrc_3 tddr tcnt_3 tgrd_3 tgrd_4 tgrc_4 tgrb_3 temp 1 tgra_4 temp 2 tgrb_4 temp 3 tcnts tcnt_4 tgra_3 tcdr tcbr comparator comparator match si g nal match si g nal output controller output protection circuit pwm cycle output pwm output 1 pwm output 2 pwm output 3 pwm output 4 pwm output 5 pwm output 6 poe0 poe1 poe2 external cutoff input external cut off interrupt : re g isters that can always be read or written from the cpu : re g isters that cannot be read or written from the cpu (except for tcnts, which can only be read) : re g isters that can be read or written from the cpu (but for which access disablin g can be set by trwer) tgra_3 compare- match interrupt tcnt_4 underflow interrupt figure 10.38 block diagram of channels 3 and 4 in complementary pwm mode
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 368 of 1080 rej09b0230-0300 example of complementary pwm mode setting procedure: an example of the complementary pwm mode setting procedure is shown in figure 10.39. complementary pwm mode stop count operation counter clock, counter clear source selection brushless dc motor control settin g tcnt settin g inter-channel synchronization settin g tgr settin g enable/disable dead time g eneration start count operation [1] clear bits cst3 and cst4 in the timer start re g ister (tstr) to 0, and halt timer counter (tcnt) operation. perform complementary pwm mode settin g when tcnt_3 and tcnt_4 are stopped. [2] set the same counter clock and clock ed g e for channels 3 and 4 with bits tpsc2 to tpsc0 and bits ckeg1 and ckeg0 in the timer control re g ister (tcr). use bits cclr2 to cclr0 to set synchronous clearin g only when restartin g by a synchronous clear from another channel durin g complementary pwm mode operation. [3] when performin g brushless dc motor control, set bit bdc in the timer g ate control re g ister (tgcr) and set the feedback si g nal input source and output choppin g or g ate si g nal direct output. [4] set the dead time in tcnt_3. set tcnt_4 to h'0000. [5] set only when restartin g by a synchronous clear from another channel durin g complementary pwm mode operation. in this case, synchronize the channel g eneratin g the synchronous clear with channels 3 and 4 usin g the timer synchro re g ister (tsyr). [6] set the output pwm duty in the duty re g isters (tgrb_3, tgra_4, tgrb_4) and buffer re g isters (tgrd_3, tgrc_4, tgrd_4). set the same initial value in each correspondin g tgr. [7] this settin g is necessary only when no dead time should be g enerated. make appropriate settin g s in the timer dead time enable re g ister (tder) so that no dead time is g enerated. [8] set the dead time in the dead time re g ister (tddr), 1/2 the carrier cycle in the carrier cycle data re g ister (tcdr) and carrier cycle buffer re g ister (tcbr), and 1/2 the carrier cycle plus the dead time in tgra_3 and tgrc_3. when no dead time g eneration is selected, set 1 in tddr and 1/2 the carrier cycle + 1 in tgra_3 and tgrc_3. [9] select enablin g /disablin g of to gg le output synchronized with the pwm cycle usin g bit psye in the timer output control re g ister 1 (tocr1), and set the pwm output level with bits olsp and olsn. when specifyin g the pwm output level by usin g tolbr as a buffer for tocr_2, see fi g ure 10.4. [10] select complementary pwm mode in timer mode re g ister 3 (tmdr_3). do not set in tmdr_4. [11] set enablin g /disablin g of pwm waveform output pin output in the timer output master enable re g ister (toer). [12] set the port control re g ister and the port i/o re g ister. [13] set bits cst3 and cst4 in tstr to 1 simultaneously to start the count operation. [1] [2] [3] [4] [5] [6] [7] [8] [9] [11] dead time, carrier cycle settin g pwm cycle output enablin g , pwm output level settin g complementary pwm mode settin g enable waveform output start count operation [10] pfc settin g [12] [13] figure 10.39 example of complementary pwm mode setting procedure
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 369 of 1080 rej09b0230-0300 outline of complementary pwm mode operation: in complementary pwm mode, 6-phase pwm output is possible. figure 10.40 illustrates counter operation in complementary pwm mode, and figure 10.41 shows an example of complementary pwm mode operation. 1. counter operation in complementary pwm mode, three counters?tcnt_3, tcnt_4, and tcnts?perform up/down-count operations. tcnt_3 is automatically initialized to the value set in tddr when complementary pwm mode is selected and the cst bit in tstr is 0. when the cst bit is set to 1, tcnt_3 counts up to the value set in tgra_3, then switches to down-counting when it matches tgra_3. when the tcnt3 value matches tddr, the counter switches to up-counting, and the operation is repeated in this way. tcnt_4 is initialized to h'0000. when the cst bit is set to 1, tcnt4 counts up in synchronization with tcnt_3, and switches to down-counting when it matches tc dr. on reaching h'0000, tcnt4 switches to up-counting, and the operation is repeated in this way. tcnts is a read-only counter. it need not be initialized. when tcnt_3 matches tcdr during tcnt_3 and tcnt_4 up/down-counting, down- counting is started, and when tcnts matches tcdr, the operation switches to up-counting. when tcnts matches tgra_3, it is cleared to h'0000. when tcnt_4 matches tddr during tcnt_3 and tcnt_4 down-counting, up-counting is started, and when tcnts matches tddr, the operation switches to down-counting. when tcnts reaches h'0000, it is set with the value in tgra_3. tcnts is compared with the compare register and temporar y register in which the pwm duty is set during the count operation only. counter value tgra_3 tcdr tddr h'0000 tcnt_4 tcnts tcnt_3 tcnt_3 tcnt_4 tcnts time figure 10.40 complementary pwm mode counter operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 370 of 1080 rej09b0230-0300 2. register operation in complementary pwm mode, nine registers ar e used, comprising compare registers, buffer registers, and temporary registers. figure 10.41 shows an example of complementary pwm mode operation. the registers which are constantly compared with the counters to perform pwm output are tgrb_3, tgra_4, and tgrb_4. when these registers match the counter, the value set in bits olsn and olsp in the timer output control register (tocr) is output. the buffer registers for these compare re gisters are tgrd_3, tgrc_4, and tgrd_4. between a buffer register and compare register there is a temporary register. the temporary registers cannot be accessed by the cpu. data in a compare register is changed by writing the new data to the corresponding buffer register. the buffer registers can be read or written at any time. the data written to a buffer register is constantly transferred to the temporary register in the ta interval. data is not transferred to the temporary register in the tb interval. data written to a buffer register in this interval is transferred to the temporary register at the end of the tb interval. the value transferred to a temporary register is transferred to the compare register when tcnts for which the tb interval ends matches tgra_3 when counting up, or h'0000 when counting down. the timing for transfer from the temporary register to the compare register can be selected with bits md3 to md0 in the timer mode register (tmdr). figure 10.41 shows an example in which the mode is selected in which the change is made in the trough. in the tb interval (tb1 in figure 10.41) in which data transfer to the temporary register is not performed, the temporary register has the same function as the compare register, and is compared with the counter. in this interval, th erefore, there are two compare match registers for one-phase output, with the compare register containing the pre-change data, and the temporary register containing the new data. in this interval, the three counters?tcnt_3, tcnt_4, and tcnts?and two registers?compare register and temporary register?are compared, and pwm output controlled accordingly.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 371 of 1080 rej09b0230-0300 tgra_3 tcdr tgra_4 tgrc_4 tddr h'0000 buffer re g ister tgrc_4 temporary re g ister temp2 compare re g ister tgra_4 output waveform output waveform t b2 t a t b1 t a t b2 t a tcnt_3 tcnt_4 tcnts (output waveform is active-low) h'6400 h'0080 h'6400 h'6400 h'0080 h'0080 transfer from temporary re g ister to compare re g ister transfer from temporary re g ister to compare re g ister figure 10.41 example of complementary pwm mode operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 372 of 1080 rej09b0230-0300 3. initialization in complementary pwm mode, there are six registers that must be initialized. in addition, there is a register that specifies whether to generate dead time (it should be used only when dead time generation should be disabled). before setting complementary pwm mode with bits md3 to md0 in the timer mode register (tmdr), the following initial register values must be set. tgrc_3 operates as the buffer register for tgra_3, and should be set with 1/2 the pwm carrier cycle + dead time td. th e timer cycle buffer register (tcbr) operates as the buffer register for the timer cycle data register (tcdr), and should be set with 1/2 the pwm carrier cycle. set dead time td in the timer dead time data register (tddr). when dead time is not needed, the tder bit in the timer dead time enable register (tder) should be cleared to 0, tgrc_3 and tgra_3 should be set to 1/2 the pwm carrier cycle + 1, and tddr should be set to 1. set the respective initial pwm duty values in buffer registers tgrd_3, tgrc_4, and tgrd_4. the values set in the five buffer registers ex cluding tddr are transferred simultaneously to the corresponding compare registers wh en complementary pwm mode is set. set tcnt_4 to h'0000 before setting complementary pwm mode. table 10.59 registers and counters requiring initialization register/counter set value tgrc_3 1/2 pwm carrier cycle + dead time td (1/2 pwm carrier cycle + 1 when dead time generation is disabled by tder) tddr dead time td (1 when dead time generation is disabled by tder) tcbr 1/2 pwm carrier cycle tgrd_3, tgrc_4, tgrd_4 initial pwm duty value for each phase tcnt_4 h'0000 note: the tgrc_3 set value must be the sum of 1/2 the pwm carrier cycle set in tcbr and dead time td set in tddr. when dead time generation is disabled by tder, tgrc_3 must be set to 1/2 the pwm carrier cycle + 1.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 373 of 1080 rej09b0230-0300 4. pwm output level setting in complementary pwm mode, the pwm pulse output level is set with bits olsn and olsp in timer output control register 1 (tocr1) or bits ols1p to ols3p and ols1n to ols3n in timer output control register 2 (tocr2). the output level can be set for each of the three positive phases and three negative phases of 6- phase output. complementary pwm mode should be cleared be fore setting or changing output levels. 5. dead time setting in complementary pwm mode, pwm pulses are output with a non-overlapping relationship between the positive and negative phases. this non-overlap time is called the dead time. the non-overlap time is set in the timer dead time data register (tddr). the value set in tddr is used as the tcnt_3 counter start value, and creates non-overlap between tcnt_3 and tcnt_4. complementary pwm mode should be cleared before changing the contents of tddr. 6. dead time suppressing dead time generation is suppressed by clearing the tder bit in the timer dead time enable register (tder) to 0. tder can be cleared to 0 only when 0 is written to it after reading tder = 1. tgra_3 and tgrc_3 should be set to 1/2 pwm carrier cycle + 1 and the timer dead time data register (tddr) should be set to 1. by the above settings, pwm waveforms without dead time can be obta ined. figure 10.42 shows an example of operation without dead time.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 374 of 1080 rej09b0230-0300 tgra_3=tcdr+1 tcdr tgra_4 tgrc_4 tddr=1 h'0000 buffer re g ister tgrc_4 temporary re g ister temp2 compare re g ister tgra_4 output waveform output waveform t a t b1 t a t b2 t a tcnt_3 tcnt_4 tcnts output waveform is active-low. data1 data2 data1 data2 data1 initial output initial output data2 transfer from temporary re g ister to compare re g ister figure 10.42 example of operation without dead time
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 375 of 1080 rej09b0230-0300 7. pwm cycle setting in complementary pwm mode, the pwm pulse cy cle is set in two registers?tgra_3, in which the tcnt_3 upper limit value is set, and tcdr, in which the tcnt_4 upper limit value is set. the settings should be made so as to achieve the following relationship between these two registers: with dead time: tgra_3 set value = tcdr set value + tddr set value without dead time: tgra_3 set value = tcdr set value + 1 the tgra_3 and tcdr settings are made by setting the values in buffer registers tgrc_3 and tcbr. the values set in tgrc_3 and tcbr are transferred simultaneously to tgra_3 and tcdr in accordance with the transfer timing select ed with bits md3 to md0 in the timer mode register (tmdr). the updated pwm cycle is reflected from the next cycle when the data update is performed at the crest, and from the current cycle when performed in the trough. figure 10.43 illustrates the operation when the pwm cycle is updated at the crest. see the following section, register data updating, for the method of updating the data in each buffer register. counter value tgrc_3 update tgra_3 update tgra_3 tcnt_3 tcnt_4 time figure 10.43 example of pwm cycle updating
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 376 of 1080 rej09b0230-0300 8. register data updating in complementary pwm mode, the buffer register is used to update the data in a compare register. the update data can be written to the buffer register at any time. there are five pwm duty and carrier cycle registers that have buffer registers and can be updated during operation. there is a temporary register between each of these registers and its buffer register. when subcounter tcnts is not counting, if buffer register data is updated, the temporary register value is also rewritten. transfer is not performed from buffer registers to temporary registers when tcnts is counting; in this case, the value written to a buffer register is transferred after tcnts halts. the temporary register value is transferred to the compare register at the data update timing set with bits md3 to md0 in the timer mode register (tmdr). figure 10.44 shows an example of data updating in complementary pwm mode. this example shows the mode in which data updating is performed at both the counter crest and trough. when rewriting buffer register data, a write to tgrd_4 must be performed at the end of the update. data transfer from the buffer registers to the temporary registers is performed simultaneously for all five registers after the write to tgrd_4. a write to tgrd_4 must be performed after writing data to the registers to be updated, even when not updating all five registers, or when updating the tgrd_4 data. in this case, the data written to tgrd_4 should be the same as the data prior to the write operation.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 377 of 1080 rej09b0230-0300 data update timing: c ounter c rest and trough transfer from temporary re g ister to compare re g ister transfer from temporary re g ister to compare re g ister transfer from temporary re g ister to compare re g ister transfer from temporary re g ister to compare re g ister transfer from temporary re g ister to compare re g ister transfer from temporary re g ister to compare re g ister counter value tgra_3 tgrc_4 tgra_4 h'0000 br data1 data2 data3 data4 data5 data6 data1 data1 data2 data3 data4 data6 data2 data3 data4 data5 data6 temp_r gr time : compare re g ister : buffer re g ister figure 10.44 example of data update in complementary pwm mode
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 378 of 1080 rej09b0230-0300 9. initial output in complementary pwm mode in complementary pwm mode, the initial output is determined by the setting of bits olsn and olsp in timer output control register 1 (tocr1) or bits ols1n to ols3n and ols1p to ols3p in timer output control register 2 (tocr2). this initial output is the pwm pulse non-active level, and is output from when complementary pwm mode is set with the timer mode regist er (tmdr) until tcnt_4 exceeds the value set in the dead time register (tddr). figure 10.45 shows an example of the initial output in complementary pwm mode. an example of the waveform when the initial pwm duty value is smaller than the tddr value is shown in figure 10.46. timer output c ontrol register settings olsn bit: 0 (initial output: hi g h; active level: low) olsp bit: 0 (initial output: hi g h; active level: low) tcnt_3 and tcnt_4 values tgra_4 tddr tcnt_3 tcnt_4 initial output dead time time active level active level tcnt_3 and tcnt_4 count start (tstr settin g ) complementary pwm mode (tmdr settin g ) positive phase output ne g ative phase output figure 10.45 example of initial output in complementary pwm mode (1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 379 of 1080 rej09b0230-0300 timer output c ontrol register settings olsn bit: 0 (initial output: hi g h; active level: low) olsp bit: 0 (initial output: hi g h; active level: low) tcnt_3 and tcnt_4 values tgra_4 tddr tcnt_3 tcnt_4 initial output time active level tcnt_3 and tcnt_4 count start (tstr settin g ) complementary pwm mode (tmdr settin g ) positive phase output ne g ative phase output figure 10.46 example of initial output in complementary pwm mode (2)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 380 of 1080 rej09b0230-0300 10. complementary pwm mode pwm output generation method in complementary pwm mode, 3-phase output is performed of pwm waveforms with a non- overlap time between the positive and negative phases. this non-overlap time is called the dead time. a pwm waveform is generated by output of the output level selected in the timer output control register in the event of a compare-match between a counter and data register. while tcnts is counting, data register and temporary register values are simultaneously compared to create consecutive pwm pulses from 0 to 100%. the relative timing of on and off compare- match occurrence may vary, but the compare-matc h that turns off each phase takes precedence to secure the dead time and ensure that the positive phase and negative phase on times do not overlap. figures 10.47 to 10.49 show examples of waveform generation in complementary pwm mode. the positive phase/negative phase off timing is generated by a compare-match with the solid- line counter, and the on timing by a compare-match with the dotted-line counter operating with a delay of the dead time behind the solid-lin e counter. in the t1 period, compare-match a that turns off the negative phase has the highest priority, and compare-matches occurring prior to a are ignored. in the t2 period, compare-match c that turns off the positive phase has the highest priority, and compare-matches occurring prior to c are ignored. in normal cases, compare-matches occur in the order a b c d (or c d a' b' ), as shown in figure 10.47. if compare-matches deviate from the a b c d order, since the time for which the negative phase is off is less than twice the dead time, the figure shows the positive phase is not being turned on. if compare-matches deviate from the c d a' b' order, since the time for which the positive phase is off is less than twice the dead time, the figure shows the negative phase is not being turned on. if compare-match c occurs first following compare-match a , as shown in figure 10.48, compare-match b is ignored, and the negative phase is turned off by compare-match d . this is because turning off of the positive phase has priority due to the occurrence of compare-match c (positive phase off timing) before compare-match b (positive phase on timing) (consequently, the waveform does not change since the positive phase goes from off to off). similarly, in the example in figure 10.49, compare-match a' with the new data in the temporary register occurs before compare-match c , but other compare-matches occurring up to c , which turns off the positive phase, are ignored. as a result, the negative phase is not turned on. thus, in complementary pwm mode, compare-ma tches at turn-off timings take precedence, and turn-on timing compare-matches that occur before a turn-off timing compare-match are ignored.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 381 of 1080 rej09b0230-0300 t2 period t1 period t1 period ab c a' b' d tgra_3 tcdr tddr h'0000 positive phase ne g ative phase figure 10.47 example of complementary pwm mode waveform output (1) t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase ne g ative phase c d a a b b figure 10.48 example of complementary pwm mode waveform output (2)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 382 of 1080 rej09b0230-0300 ab c a' b' d t1 period t2 period t1 period tgra_3 tcdr tddr h'0000 positive phase ne g ative phase figure 10.49 example of complementary pwm mode waveform output (3) a b c d a' b' t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase ne g ative phase figure 10.50 example of complementary pwm mode 0% and 100% waveform output (1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 383 of 1080 rej09b0230-0300 t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase ne g ative phase a c d a b b figure 10.51 example of complementary pwm mode 0% and 100% waveform output (2) t2 period t1 period t1 period a b c d tgra_3 tcdr tddr h'0000 positive phase ne g ative phase figure 10.52 example of complementary pwm mode 0% and 100% waveform output (3)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 384 of 1080 rej09b0230-0300 tgra_3 tcdr tddr h'0000 positive phase ne g ative phase t2 period t1 period t1 period a b c b' a' d figure 10.53 example of complementary pwm mode 0% and 100% waveform output (4) cad b t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase ne g ative phase figure 10.54 example of complementary pwm mode 0% and 100% waveform output (5)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 385 of 1080 rej09b0230-0300 11. complementary pwm mode 0% and 100% duty output in complementary pwm mode, 0% and 100% duty cycles can be output as required. figures 10.50 to 10.54 show output examples. 100% duty output is performed when the data register value is set to h'0000. the waveform in this case has a positive phase with a 100% on-state. 0% duty output is performed when the data register value is set to the same value as tgra_3. the waveform in this case has a positive phase with a 100% off-state. on and off compare-matches occur simultaneousl y, but if a turn-on compare-match and turn- off compare-match for the same phase occu r simultaneously, both compare-matches are ignored and the waveform does not change. 12. toggle output synchronized with pwm cycle in complementary pwm mode, toggle output can be performed in synchronization with the pwm carrier cycle by setting the psye bit to 1 in the timer output control register (tocr). an example of a toggle output waveform is shown in figure 10.55. this output is toggled by a compare-match between tcnt_3 and tgra_3 and a compare- match between tcnt4 and h'0000. the output pin for this toggl e output is the tioc3a pin. the initial output is 1. tgra_3 h'0000 to gg le output tioc3a pin tcnt_4 tcnt_3 figure 10.55 example of toggle output waveform synchronized with pwm output
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 386 of 1080 rej09b0230-0300 13. counter clearing by another channel in complementary pwm mode, by setting a mode for synchronization with another channel by means of the timer synchronous register (tsyr), and selecting synchronous clearing with bits cclr2 to cclr0 in the timer control register (tcr), it is possible to have tcnt_3, tcnt_4, and tcnts cleared by another channel. figure 10.56 illustrates the operation. use of this function enables counter clearing and restarting to be performed by means of an external signal. tgra_3 tcdr tddr h'0000 channel 1 input capture a tcnt_1 tcnt_3 tcnt_4 tcnts syn c hronous c ounter c learing by c hannel 1 input c apture a figure 10.56 counter clearing synchronized with another channel
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 387 of 1080 rej09b0230-0300 14. output waveform control at synchronous counter clearing in complementary pwm mode setting the wre bit in twcr to 1 suppresses initial output when synchronous counter clearing occurs in the tb inte rval at the trough in complementary pwm mode and controls abrupt change in duty cycle at synchronous counter clearing. initial output suppression is applicable only when synchronous clearing occurs in the tb interval at the trough as indicated by (10) or (11) in figure 10.57. when synchronous clearing occurs outside that interval, the initial value specified by the ols bits in tocr is output. even in the tb interval at the trough, if synchronous clear ing occurs in the initial value output period (indicated by (1) in figure 10.57) immediately after the counters start operation, initial value output is not suppressed. this function can be used in both the mtu2 and mtu2s. in the mtu2, synchronous clearing generated in channels 0 to 2 in the mtu2 can cause counter clearing in complementary pwm mode; in the mtu2s, compare match or input ca pture flag setting in channels 0 to 2 in the mtu2 can cause counter clearing. tb interval tb interval tb interval tgra_3 tgrb_3 tcdr tcnt_3 tcnt_4 tddr h'0000 positive phase ne g ative phase output waveform is active-low (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) counter start figure 10.57 timing for synchronous counter clearing
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 388 of 1080 rej09b0230-0300 ? example of procedure for setting output waveform control at synchronous counter clearing in complementary pwm mode an example of the procedure for setting output waveform control at synchronous counter clearing in complementary pwm mode is shown in figure 10.58. stop count operation output waveform control at synchronous counter clearin g set twcr and complementary pwm mode start count operation output waveform control at synchronous counter clearin g [1] [2] [3] [1] clear bits cst3 and cst4 in the timer start re g ister (tstr) to 0, and halt timer counter (tcnt) operation. perform twcr settin g while tcnt_3 and tcnt_4 are stopped. [2] read bit wre in twcr and then write 1 to it to suppress initial value output at counter clearin g . [3] set bits cst3 and cst4 in tstr to 1 to start count operation. figure 10.58 example of procedure for setting output waveform control at synchronous counter clearing in complementary pwm mode ? examples of output waveform control at synchronous counter clearing in complementary pwm mode figures 10.59 to 10.62 show examples of output waveform control in which the mtu2 operates in complementary pwm mode and synchronous counter clearing is generated while the wre bit in twcr is set to 1. in the examples shown in figures 10.59 to 10.62, synchronous counter clearing occurs at timing (3), (6), (8), and (11) shown in figure 10.57, respectively. in the mtu2s, these examples are equivalent to the cases when th e mtu2s operates in complementary pwm mode and synchronous counter clearing is generated while the scc bit is cleared to 0 and the wre bit is set to 1 in twcr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 389 of 1080 rej09b0230-0300 tgra_3 tgrb_3 tcdr tddr h'0000 positive phase ne g ative phase output waveform is active-low. synchronous clearin g tcnt_3 (mtu2) tcnt_4 (mtu2) bit wre = 1 figure 10.59 example of synchronous clearing in dead time during up-counting (timing (3) in figure 10.57; bit wre of twcr in mtu2 is 1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 390 of 1080 rej09b0230-0300 positive phase ne g ative phase output waveform is active-low. synchronous clearin g bit wre = 1 tcnt_3 (mtu2) tcnt_4 (mtu2) tgra_3 tgrb_3 tcdr tddr h'0000 figure 10.60 example of synchronous clearing in interval tb at crest (timing (6) in figure 10.57; bit wre of twcr in mtu2 is 1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 391 of 1080 rej09b0230-0300 positive phase ne g ative phase output waveform is active-low. synchronous clearin g bit wre = 1 tcnt_3 (mtu2) tcnt_4 (mtu2) tgra_3 tgrb_3 tcdr tddr h'0000 figure 10.61 example of synchronous clearing in dead time during down-counting (timing (8) in figure 10.57; bit wre of twcr is 1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 392 of 1080 rej09b0230-0300 positive phase ne g ative phase output waveform is active-low. synchronous clearin g bit wre = 1 tgra_3 tgrb_3 tcdr tddr h'0000 initial value output is suppressed. tcnt_3 (mtu2) tcnt_4 (mtu2) figure 10.62 example of synchronous clearing in interval tb at trough (timing (11) in figure 10.57; bit wre of twcr is 1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 393 of 1080 rej09b0230-0300 15. suppressing mtu2?mtu2s synchronous counter clearing in the mtu2s, setting the scc bit in twcr to 1 suppresses synchronous counter clearing caused by the mtu2. synchronous counter clearing is suppressed only within the interval shown in figure 10.63. when using this function, the mtu2s should be set to complementary pwm mode. for details of synchronous clearing caused by the mtu2, refer to the description about mtu2s counter clearing caused by mtu2 flag setting source (mtu2-mtu2s synchronous counter clearing) in section 10.4.10, mtu2?mtu2s synchronous operation. tb interval at the crest tb interval at the trou g h tb interval at the crest tb interval at the trou g h tgra_3 tgrb_3 tcdr tddr h'0000 tb interval immediately after counter operation starts mtu2-mtu2s synchronous counter clearin g is suppressed. mtu2-mtu2s synchronous counter clearin g is suppressed. figure 10.63 mtu2?mtu2s synchronous clearing-suppressed interval specified by scc bit in twcr
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 394 of 1080 rej09b0230-0300 ? example of procedure for suppressing mtu2?mtu2s synchronous counter clearing an example of the procedure for suppressing mtu2?mtu2s synchronous counter clearing is shown in figure 10.64. stop count operation (mtu2 and mtu2s) mtu2-mtu2s synchronous counter clearin g suppress start count operation (mtu2 and mtu2s) output waveform control at synchronous counter clearin g and synchronous counter clearin g suppress [1] [3] ? set the followin g . ? complementary pwm mode (mtu2s) ? compare match/input capture operation (mtu2) ? bit wre in twcr (mtu2s) [2] set bit scc in twcr (mtu2s) [4] [1] clear bits cst of the timer start re g ister (tstr) in the mtu2s to 0, and halt count operation. clear bits cst of tstr in the mtu2 to 0, and halt count operation. [2] set the complementary pwm mode in the mtu2s and compare match/input capture operation in the mtu2. when bit wre in twcr should be set, make appropriate settin g here. [3] set bits cst3 and cst4 of tstr in the mtu2s to 1 to start count operation. for mtu2-mtu2s synchronous counter clearin g , set bits cst of tstr in the mtu2 to 1 to start count operation in any one of tcnt_0 to tcnt_2. [4] read twcr and then set bit scc in twcr to 1 to suppress mtu2-mtu2s synchronous counter clearin g * . here, do not modify the cce and wre bit values in twcr of the mtu2s. mtu2-mtu2s synchronous counter clearin g is suppressed in the intervals shown in fi g ure 10.63. note: * the scc bit value can be modified durin g counter operation. however, if a synchronous clearin g occurs when bit scc is modified from 0 to 1, the synchronous clearin g may not be suppressed. if a synchronous clearin g occurs when bit scc is modified from 1 to 0, the synchronous clearin g may be suppressed. figure 10.64 example of procedure for suppressing mtu2?mtu2s synchronous counter clearing ? examples of suppression of mtu2?mtu2s synchronous counter clearing figures 10.65 to 10.68 show examples of operation in which the mtu2s operates in complementary pwm mode and mtu2?mtu2s synchronous counter clearing is suppressed by setting the scc bit in twcr in th e mtu2s to 1. in the examples shown in figures 10.65 to 10.68, synchronous counter clearing occurs at timing (3), (6), (8), and (11) shown in figure 10.57, respectively. in these examples, the wre bit in twcr of the mtu2s is set to 1.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 395 of 1080 rej09b0230-0300 tgra_3 tgrb_3 tcdr tddr h'0000 positive phase ne g ative phase output waveform is active-low. mtu2-mtu2s synchronous clearin g tcnt_3 (mtu2s) tcnt_4 (mtu2s) bit wre = 1 bit scc = 1 counters are not cleared figure 10.65 example of synchronous clearing in dead time during up-counting (timing (3) in figure 10.57; bit wre is 1 and bit scc is 1 in twcr of mtu2s)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 396 of 1080 rej09b0230-0300 positive phase ne g ative phase output waveform is active-low. mtu2-mtu2s synchronous clearin g bit wre = 1 bit scc = 1 counters are not cleared tgra_3 tgrb_3 tcdr tddr h'0000 tcnt_3 (mtu2s) tcnt_4 (mtu2s) figure 10.66 example of synchronous clearing in interval tb at crest (timing (6) in figure 10.57; bit wre is 1 and bit scc is 1 in twcr of mtu2s)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 397 of 1080 rej09b0230-0300 positive phase ne g ative phase output waveform is active-low. mtu2-mtu2s synchronous clearin g bit wre = 1 bit scc = 1 counters are not cleared tgra_3 tgrb_3 tcdr tddr h'0000 tcnt_3 (mtu2s) tcnt_4 (mtu2s) figure 10.67 example of synchronous clearing in dead time during down-counting (timing (8) in figure 10.57; bit wre is 1 and bit scc is 1 in twcr of mtu2s)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 398 of 1080 rej09b0230-0300 positive phase ne g ative phase output waveform is active-low. mtu2-mtu2s synchronous clearin g bit wre = 1 bit scc = 1 tgra_3 tgrb_3 tcdr tddr h'0000 tcnt_3 (mtu2s) tcnt_4 (mtu2s) counters are cleared initial value output is suppressed. figure 10.68 example of synchronous clearing in interval tb at trough (timing (11) in figure 10.57; bit wre is 1 and bit scc is 1 in twcr of mtu2s)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 399 of 1080 rej09b0230-0300 16. counter clearing by tgra_3 compare match in complementary pwm mode, by setting the cce bit in the timer waveform control register (twcr), it is possible to have tcnt_3, tcnt_4, and tcnts cleared by tgra_3 compare match. figure 10.69 illustrates an operation example. notes: 1. use this function only in complementary pwm mode 1 (transfer at crest) 2. do not specify synchronous clearing by another channel (do not set the sync0 to sync4 bits in the timer synchronous register (tsyr) to 1 or the ce0a, ce0b, ce0c, ce0d, ce1a, ce1b, ce1c, and ce1d bits in the timer synchronous clear register (tsycr) to 1). 3. do not set the pwm duty value to h'0000. 4. do not set the psye bit in timer output control register 1 (tocr1) to 1. tgra_3 tgrb_3 tcdr tddr h'0000 output waveform output waveform output waveform is active-hi g h. counter cleared by tgra_3 compare match figure 10.69 example of counter cleari ng operation by tgra_3 compare match
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 400 of 1080 rej09b0230-0300 17. example of ac synchronous motor (brushless dc motor) drive waveform output in complementary pwm mode, a brushless dc motor can easily be controlled using the timer gate control register (tgcr). figures 10.70 to 10.73 show examples of brushless dc motor drive waveforms created using tgcr. when output phase switching for a 3-phase brushless dc motor is performed by means of external signals detected with a hall element, etc., clear the fb b it in tgcr to 0. in this case, the external signals indicating the polarity position are input to channel 0 timer input pins tioc0a, tioc0b, and tioc0c (set with pfc). when an edge is detected at pin tioc0a, tioc0b, or tioc0c, the output on/off state is switched automatically. when the fb bit is 1, the output on/off state is switched when the uf, vf, or wf bit in tgcr is cleared to 0 or set to 1. the drive waveforms are output from the complementary pwm mode 6-phase output pins. with this 6-phase output, in the case of on output, it is possible to use complementary pwm mode output and perform chopping output by setting the n bit or p bit to 1. when the n bit or p bit is 0, level output is selected. the 6-phase output active level (on output level) can be set with the olsn and olsp bits in the timer output control register (tocr) regardless of the setting of the n and p bits. external input tioc0a pin tioc0b pin tioc0c pin tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bdc = 1, n = 0, p = 0, fb = 0, output a c tive level = high figure 10.70 example of output phase switching by external input (1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 401 of 1080 rej09b0230-0300 external input tioc0a pin tioc0b pin tioc0c pin tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bdc = 1, n = 1, p = 1, fb = 0, output a c tive level = high figure 10.71 example of output phase switching by external input (2) tgcr uf bit vf bit wf bit tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bdc = 1, n = 0, p = 0, fb = 1, output a c tive level = high figure 10.72 example of output phase switching by means of uf, vf, wf bit settings (1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 402 of 1080 rej09b0230-0300 tgcr uf bit vf bit wf bit tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bdc = 1, n = 1, p = 1, fb = 1, output a c tive level = high figure 10.73 example of output phase switching by means of uf, vf, wf bit settings (2) 18. a/d converter start request setting in complementary pwm mode, an a/d converter start request can be issued using a tgra_3 compare-match, tcnt_4 underflow (trough), or compare-match on a channel other than channels 3 and 4. when start requests using a tgra_3 compare-match are specified, a/d conversion can be started at the crest of the tcnt_3 count. a/d converter start requests can be set by se tting the ttge bit to 1 in the timer interrupt enable register (tier). to issue an a/d converter start request at a tcnt_4 underflow (trough), set the ttge2 bit in tier_4 to 1.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 403 of 1080 rej09b0230-0300 interrupt skipping in complementary pwm mode: interrupts tgia_3 (at the crest) and tciv_4 (at the trough) in channels 3 and 4 can be skipped up to seven times by making settings in the timer interrupt skipping set register (titcr). transfers from a buffer register to a temporary regi ster or a compare register can be skipped in coordination with interrupt skipping by making settings in the timer buffer transfer register (tbter). for the linkage with buffer registers, refer to description 3, buffer transfer control linked with interrupt skipping, below. a/d converter start requests generated by the a/d converter start request delaying function can also be skipped in coordination with interrupt skipping by making settings in the timer a/d converter request control register (tadcr). for the linkage with the a/d converter start request delaying function, refer to section 10.4.9, a/ d converter start request delaying function. the setting of the timer interrupt skipping setting register (titcr) must be done while the tgia_3 and tciv_4 interrupt requests are disabled by the settings of tier_3 and tier_4 along with under the conditions in which tgfa_3 and tcfv_4 flag settings by compare match never occur. before changing the skipping count, be sure to clear the t3aen and t4ven bits to 0 to clear the skipping counter. 1. example of interrupt skipping operation setting procedure figure 10.74 shows an example of the interrupt skipping operation setting procedure. figure 10.75 shows the periods during which interrupt skipping count can be changed. clear interrupt skippin g counter interrupt skippin g set skippin g count and enable interrupt skippin g [1] [2] [1] set bits t3aen and t4ven in the timer interrupt skippin g set re g ister (titcr) to 0 to clear the skippin g counter. [2] specify the interrupt skippin g count within the ran g e from 0 to 7 times in bits 3acor2 to 3acor0 and 4vcor2 to 4vcor0 in titcr, and enable interrupt skippin g throu g h bits t3aen and t4ven. note: the settin g of titcr must be done while the tgia_3 and tciv_4 interrupt requests are disabled by the settin g s of tier_3 and tier_4 alon g with under the conditions in which tgfa_3 and tcfv_4 fla g settin g s by compare match never occur. before chan g in g the skippin g count, be sure to clear the t3aen and t4ven bits to 0 to clear the skippin g counter. figure 10.74 example of interrupt skipping operation setting procedure
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 404 of 1080 rej09b0230-0300 tcnt_3 tcnt_4 period durin g which chan g in g skippin g count can be performed period durin g which chan g in g skippin g count can be performed period durin g which chan g in g skippin g count can be performed period durin g which chan g in g skippin g count can be performed figure 10.75 periods during which in terrupt skipping count can be changed 2. example of interrupt skipping operation figure 10.76 shows an example of tgia_3 interrupt skipping in which the interrupt skipping count is set to three by the 3acor bit and the t3aen bit is set to 1 in the timer interrupt skipping set register (titcr). tgia_3 interrupt fla g set si g nal skippin g counter tgfa_3 fla g interrupt skippin g period 00 01 02 03 00 01 02 03 interrupt skippin g period figure 10.76 example of interrupt skipping operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 405 of 1080 rej09b0230-0300 3. buffer transfer control linked with interrupt skipping in complementary pwm mode, whether to transfer data from a buffer register to a temporary register and whether to link the transfer with interrupt skipping can be specified with the bte1 and bte0 bits in the timer buffer transfer set register (tbter). figure 10.77 shows an example of operation when buffer transfer is suppressed (bte1 = 0 and bte0 = 1). while this setting is valid, data is not transferred from the buffer register to the temporary register. figure 10.78 shows an example of operation when buffer transfer is linked with interrupt skipping (bte1 = 1 and bet0 = 0). while this setting is valid, data is not transferred from the buffer register outside the buffer transfer-enabled period. note that the buffer transfer-enabled period depends on the t3aen and t4ven bit settings in the timer interrupt skipping set register (titcr). figure 10.79 shows the relationship between the t3aen and t4ven bit settings in titcr and buffer transfer-enabled period. note: this function must always be used in combination with interrupt skipping. when interrupt skipping is disabled (the t3aen and t4ven bits in the timer interrupt skipping set register (titcr) are cleared to 0 or the skipping count set bits (3acor and 4vcor) in titcr are cleared to 0), make sure that buffer transfer is not linked with interrupt skipping (clear the bte1 bit in the timer buffer transfer set register (tbter) to 0). if buffer transfer is linked with interrupt skipping while interrupt skipping is disabled, buffer transfer is never performed.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 406 of 1080 rej09b0230-0300 buffer re g ister temporary re g ister general re g ister tcnt_3 tcnt_4 data1 data2 data * data2 data * data2 (1) (2) (3) buffer transfer is suppressed note: * when buffer transfer at the crest is selected. data1 bit bte1 in tbter bit bte0 in tbter (1) no data is transferred from the buffer re g ister to the temporary re g ister in the buffer transfer-disabled period (bits bte1 and bte0 in tbter are set to 0 and 1, respectively). (2) data is transferred from the temporary re g ister to the g eneral re g ister even in the buffer transfer-disabled period. (3) after buffer transfer is enabled, data is transferred from the buffer re g ister to the temporary re g ister. [le g end] figure 10.77 example of operation when buffer transfer is suppressed (bte1 = 0 and bte0 = 1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 407 of 1080 rej09b0230-0300 buffer re g ister temporary re g ister general re g ister tcnt_3 tcnt_4 data1 data2 data * data * data2 data * data2 note: * buffer transfer at the crest is selected. the skippin g count is set to three. t3aen is set to 1. buffer transfer-enabled period figure 10.78 example of operation when buffer transfer is linked with interrupt skipping (bte1 = 1 and bte0 = 0) note: the skipping count is set to three. buffer transfer-enabled period (t3aen is set to 1) buffer transfer-enabled period (t4ven is set to 1) buffer transfer-enabled period (t3aen and t4ven are set to 1) 00 123 0123 0123 0123 skipping counter 3acnt skipping counter 4vcnt figure 10.79 relationship between bits t3aen and t4ven in titcr and buffer transfer-enabled period
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 408 of 1080 rej09b0230-0300 complementary pwm mode output protection function: complementary pwm mode output has the following protection functions. 1. register and counter miswrite prevention function with the exception of the buffer registers, which can be rewritten at any time, access by the cpu can be enabled or disabled for the mode re gisters, control registers, compare registers, and counters used in complementary pwm mode by means of the rwe bit in the timer read/write enable register (trw er). the applicable registers ar e some (21 in total) of the registers in channels 3 and 4 shown in the following: ? tcr_3 and tcr_4, tmdr_3 and tmdr_4, tiorh_3 and tiorh_4, tiorl_3 and tiorl_4, tier_3 and tier_4, tcnt_3 and tcnt_4, tgra_3 and tgra_4, tgrb_3 and tgrb_4, toer, tocr, tgcr, tcdr, and tddr. this function enables miswriting due to cpu runaway to be prevented by disabling cpu access to the mode registers, control registers, and counters. when the applicable registers are read in the access-disabled state, undefined valu es are returned. writing to these registers is ignored. 2. halting of pwm output by external signal the 6-phase pwm output pins can be set automatically to the high-impedance state by inputting specified external signals. there are four external signal input pins. see section 11, port output enable (poe), for details. 3. halting of pwm output when oscillator is stopped if it is detected that the clock input to this lsi has stopped, the 6-phase pwm output pins automatically go to the high-imp edance state. the pin states ar e not guaranteed when the clock is restarted. see section 4.7, function for detecting oscillator stop.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 409 of 1080 rej09b0230-0300 10.4.9 a/d converter start request delaying function a/d converter start requests can be issued in channel 4 by making settings in the timer a/d converter start request control register (tadcr), timer a/d converter start request cycle set registers (tadcora_4 and tadcorb_4), and timer a/d converter start request cycle set buffer registers (tadcobra_4 and tadcobrb_4). the a/d converter start request delaying function compares tcnt_4 with tadcora_4 or tadcorb_4, and when their values match, the function issues a respective a/d converter start request (trg4an or trg4bn). a/d converter start requests (trg4an and trg4bn) can be skipped in coordination with interrupt skipping by making settings in the ita3ae, ita4ve, itb3ae, and itb4ve bits in tadcr. 1. example of procedure for specifying a/d converter start request delaying function figure 10.80 shows an example of procedure for specifying the a/d converter start request delaying function. set a/d converter start request cycle a/d converter start request delayin g function ? set the timin g of transfer from cycle set buffer re g ister ? set linka g e with interrupt skippin g ? enable a/d converter start request delayin g function a/d converter start request delayin g function [1] [2] [1] set the cycle in the timer a/d converter start request cycle buffer re g ister (tadcobra_4 or tadcobrb_4) and timer a/d converter start request cycle re g ister (tadcora_4 or tadcorb_4). (the same initial value must be specified in the cycle buffer re g ister and cycle re g ister.) [2] use bits bf1 and bf2 in the timer a/d converter start request control re g ister (tadcr) to specify the timin g of transfer from the timer a/d converter start request cycle buffer re g ister to a/d converter start request cycle re g ister. ? specify whether to link with interrupt skippin g throu g h bits ita3ae, ita4ve, itb3ae, and itb4ve. ? use bits tu4ae, dt4ae, ut4be, and dt4be to enable a/d conversion start requests (trg4an or trg4bn). notes: 1. perform tadcr settin g while tcnt_4 is stopped. 2. do not set bf1 to 1 when complementary pwm mode is not selected. 3. do not set ita3ae, ita4ve, itb3ae, itb4ve, dt4ae, or dt4be to 1 when complementary pwm mode is not selected. figure 10.80 example of proce dure for specifying a/d converter start request delaying function
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 410 of 1080 rej09b0230-0300 2. basic operation example of a/d converter start request delaying function figure 10.81 shows a basic example of a/d converter request signal (trg4an) operation when the trough of tcnt_4 is specified for the buffer transfer timing and an a/d converter start request signal is output during tcnt_4 down-counting. tadcora_4 tadcobra_4 tcnt_4 transfer from cycle buffer re g ister to cycle re g ister transfer from cycle buffer re g ister to cycle re g ister transfer from cycle buffer re g ister to cycle re g ister a/d converter start request (trg4an) (complementary pwm mode) figure 10.81 basic example of a/d converter start request signal (trg4an) operation 3. buffer transfer the data in the timer a/d converter start request cycle set registers (tadcora_4 and tadcorb_4) is updated by writing data to the timer a/d converter start request cycle set buffer registers (tadcobra_4 and tadcobrb_4). data is transferred from the buffer registers to the respective cycle set registers at the timing selected with the bf1 and bf0 bits in the timer a/d converter start request control register (tadcr_4). 4. a/d converter start request delaying function linked with interrupt skipping a/d converter start requests (trg4an and trg4bn) can be issued in coordination with interrupt skipping by making settings in the ita3ae, ita4ve, itb3ae, and itb4ve bits in the timer a/d converter start request control register (tadcr). figure 10.82 shows an example of a/d converter start request signal (trg4an) operation when trg4an output is enabled during tcnt_4 up-counting and down-counting and a/d converter start requests are linked with interrupt skipping. figure 10.83 shows another example of a/d converter start request signal (trg4an) operation when trg4an output is enabled during tcnt_4 up-counting and a/d converter start requests are linked with interrupt skipping.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 411 of 1080 rej09b0230-0300 note: this function must be used in combination with interrupt skipping. when interrupt skipping is disabled (the t3aen and t4ven bits in the timer interrupt skipping set register (titcr) are cleared to 0 or the skipping count set bits (3acor and 4vcor) in titcr are cleared to 0), make sure that a/d converter start requests are not linked with interrupt skipping (clear the ita3ae, ita4ve, itb3ae, and itb4ve bits in the timer a/d converter start request control register (tadcr) to 0). tadcora_4 tcnt_4 a/d converter start request (trg4an) note: when the interrupt skipping count is set to two. tgia_3 interrupt skipping counter tciv_4 interrupt skipping counter tgia_3 a/d request-enabled period tciv_4 a/d request-enabled period when linked with tgia_3 and tciv_4 interrupt skipping when linked with tgia_3 interrupt skipping when linked with tciv_4 interrupt skipping 00 01 00 01 02 00 01 00 01 02 (ut4ae/dt4ae = 1) figure 10.82 example of a/d converter start request signal (trg4an) operation linked with interrupt skipping
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 412 of 1080 rej09b0230-0300 a/d converter start request (trg4an) note: when the interrupt skipping count is set to two. tgia_3 interrupt skipping counter tciv_4 interrupt skipping counter tgia_3 a/d request-enabled period tciv_4 a/d request-enabled period when linked with tgia_3 and tciv_4 interrupt skipping when linked with tgia_3 interrupt skipping when linked with tciv_4 interrupt skipping tadcora_4 tcnt_4 00 01 00 01 02 00 01 00 01 02 ut4ae = 1 dt4ae = 0 figure 10.83 example of a/d converter start request signal (trg4an) operation linked with interrupt skipping
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 413 of 1080 rej09b0230-0300 10.4.10 mtu2?mtu2s synchronous operation mtu2?mtu2s synchronous counter start: the counters in the mtu2 and mtu2s which operate at different clock systems can be started synchronously by making the tcsystr settings in the mtu2. 1. example of mtu2?mtu 2s synchronous counter start setting procedure figure 10.84 shows an example of synchronous counter start setting procedure. stop count operation mtu2-mtu2s synchronous counter start set the necessary operation [1] [2] set tcsystr [3] [1] use tstr re g isters in the mtu2 and mtu2s and halt the counters used for synchronous start operation. [2] specify necessary operation with appropriate re g isters such as tcr and tmdr. [3] in tcsystr in the mtu2, set the bits correspondin g to the counters to be started synchronously to 1. the tstrs are automatically set appropriately and the counters start synchronously. notes: 1. even if a bit in tcsystr correspondin g to an operatin g counter is cleared to 0, the counter will not stop. to stop the counter, clear the correspondin g bit in tstr to 0 directly. 2. to start channels 3 and 4 in reset-synchronized pwm mode or complementary pwm mode, make appropriate settin g s in tcystr accordin g to the tstr settin g for the respective mode. for details, refer to section 10.4.7, reset-synchronized pwm mode, and section 10.4.8, complementary pwm mode. figure 10.84 example of synchronous counter start setting procedure
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 414 of 1080 rej09b0230-0300 2. examples of synchronous counter start operation figures 10.85 (1), 10.85 (2), 10.85 (3), and 10.85 (4) shows examples of synchronous counter start operation when the clock frequency ratio between the mtu2 and mtu2s is 1:1, 1:2, 1:3, and 1:4, respectively. in these examples, the counte r clock of the mtu2 is mp /1. mtu2 clock mtu2s clock mtu2/tstr mtu2s/tstr h'51 tcsystr h'00 h'42 h'00 h'80 h'00 h'00 h'0001 mtu2/tcnt_1 h'0000 h'0002 h'0001 h'0002 mtu2s/tcnt_4 h'0000 automatically cleared after tcsystr settin g is made figure 10.85 (1) example of synchronous counter start operation (mtu2-to-mtu2s clock frequency ratio = 1:1)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 415 of 1080 rej09b0230-0300 mtu2 clock mtu2s clock automatically cleared after tcsystr settin g is made mtu2/tstr mtu2s/tstr h'51 tcsystr h'00 h'42 h'00 h'80 h'00 h'00 h'0001 mtu2/tcnt_1 h'0000 h'0002 h'0001 mtu2s/tcnt_4 h'0000 h'0002 h'0003 h'0004 figure 10.85 (2) example of synchronous counter start operation (mtu2-to-mtu2s clock frequency ratio = 1:2) mtu2 clock mtu2s clock automatically cleared after tcsystr settin g is made mtu2/tstr mtu2s/tstr h'51 tcsystr h'00 h'42 h'00 h'80 h'00 h'00 h'0001 mtu2/tcnt_1 h'0000 h'0002 h'0001 mtu2s/tcnt_4 h'0000 h'0002 h'0003 h'0004 figure 10.85 (3) example of synchronous counter start operation (mtu2-to-mtu2s clock frequency ratio = 1:3)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 416 of 1080 rej09b0230-0300 mtu2 clock mtu2s clock automatically cleared after tcsystr settin g is made mtu2/tstr mtu2s/tstr h'51 tcsystr h'00 h'42 h'00 h'80 h'00 h'00 h'0001 mtu2/tcnt_1 h'0000 h'0002 h'0001 mtu2s/tcnt_4 h'0000 h'0002 h'0003 h'0004 figure 10.85 (4) example of synchronous counter start operation (mtu2-to-mtu2s clock frequency ratio = 1:4)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 417 of 1080 rej09b0230-0300 mtu2s counter clearing caused by mtu2 flag se tting source (mtu2?mtu2s synchronous counter clearing): the mtu2s counters can be cleared by sources for setting the flags in tsr_0 to tsr_2 in the mtu2 th rough the tsycr_3 settings in the mtu2s. 1. example of procedure for specifying mtu2 s counter clearing by mtu2 flag setting source figure 10.86 shows an example of procedure for specifying mtu2s counter clearing by mtu2 flag setting source. stop count operation mtu2s counter clearin g by mtu2s fla g settin g source set tsycr_3 [1] [2] [3] [1] [4] start one of channels 0 to 2 in mtu2 start channel 3 or 4 in mtu2s [1] use tstr re g isters in the mtu2 and mtu2s and halt the counters used for this function. [2] use tsycr_3 in the mtu2s to specify the fla g settin g source to be used for the tcnt_3 and tcnt_4 clearin g source. [3] start tcnt_3 or tcnt_4 in the mtu2s. [4] start tcnt_0, tcnt_1, or tcnt_2 in the mtu2. note: the tsycr_3 settin g is i g nored while the counter is stopped. the settin g becomes valid after tcnt_3 or tcnt4 is started. figure 10.86 example of proce dure for specifying mtu2s counter clearing by mtu2 flag setting source
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 418 of 1080 rej09b0230-0300 2. examples of mtu2s counter clearing caused by mtu2 flag setting source figures 10.87 (1) and 10.87 (2) show examples of mts2s counter clearing caused by mtu2 flag setting source. tcnt_0 value in mtu2 tgra_0 h'0000 time compare match between tcnt_0 and tgra_0 tcnt_0 in mtu2 tcnt_4 value in mtu2s h'0000 time tcnt_4 in mtu2s tsycr_3 h'00 h'80 figure 10.87 (1) example of mtu2s count er clearing caused by mtu2 flag setting source (1) tcnt_0 value in mtu2 tgrd_0 tgrb_0 tgrc_0 tgra_0 h'0000 time compare match between tcnt_0 and tgr tcnt_0 in mtu2 tcnt_4 value in mtu2s h'0000 time tcnt_4 in mtu2s tsycr_3 h'00 h'f0 figure 10.87 (2) example of mtu2s count er clearing caused by mtu2 flag setting source (2)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 419 of 1080 rej09b0230-0300 10.4.11 external pulse width measurement the pulse widths of up to three external input lines can be measured in channel 5. example of external pulse width measurement setting procedure: [1] use bits tpsc1 and tpsc0 in tcr to select the counter clock. [2] in tior, select the hi g h level or low level for the pulse width measurin g condition. [3] set bits cst in tstr to 1 to start count operation. notes: 1. do not set bits cmpclr5u, cmpclr5v, or cmpclr5w in tcntcmpclr to 1. 2. do not set bits tgie5u, tgie5v, or tgie5w in tier_5 to 1. 3. the value in tcnt is not captured in tgr. select counter clock external pulse width measurement select pulse width measurin g conditions start count operation [1] [2] [3] figure 10.88 example of external pu lse width measurement setting procedure example of external pu lse width measurement: 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0007 000a 000b tic5u tcnt5_u mp figure 10.89 example of external pulse width measurement (measuring high pulse width)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 420 of 1080 rej09b0230-0300 10.4.12 dead time compensation by measuring the delay of the output waveform and reflecting it to duty, the external pulse width measurement function can be used as the dead time compensation function while the complementary pwm is in operation. tdead tdelay upper arm signal lower arm signal inverter output detection signal dead time delay signal figure 10.90 delay in dead time in complementary pwm operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 421 of 1080 rej09b0230-0300 example of dead time compensation setting procedure: figure 10.91 shows an example of dead time compensation setting procedure by using three counters in channel 5. tcnt_5 input capture occurs external pulse width measurement complementary pwm mode interrupt processing start count operation in channels 3 to 5 [3] [4] * [5] [1] [2] [1] place channels 3 and 4 in complementary pwm mode. for details, refer to section 10.4.8, complementary pwm mode. [2] specify the external pulse width measurement function for the target tior in channel 5. for details, refer to section 10.4.11, external pulse width measurement. [3] set bits cst3 and cst4 in tstr and bits cst5u, cst5v, and cst5w in tstr2 to 1 to start count operation. [4] when the capture condition specified in tior is satisfied, the tcnt_5 value is captured in tgr_5. [5] for u-phase dead time compensation, when an interrupt is generated at the crest (tgia_3) or trough (tciv_4) in complementary pwm mode, read the tgru_5 value, calculate the difference in time in tgrb_3, and write the corrected value to tgrd_3 in the interrupt processing. for the v phase and w phase, read the tgrv_5 and tgrw_5 values and write the corrected values to tgrc_4 and tgrd_4, respectively, in the same way as for u-phase compensation. the tcnt_5 value should be cleared through the tcntcmpclr setting or by software. notes: the pfc settings must be completed in advance. * as an interrupt flag is set under the capture condition specified in tior, do not enable interrupt requests in tier_5. figure 10.91 example of dead time compensation setting procedure mtu ch3/4 ch5 complementary pwm output dead time delay input inverter output monitor signals -+ u v w u v w u v w motor  level conversion dc figure 10.92 example of moto r control circuit configuration
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 422 of 1080 rej09b0230-0300 10.4.13 tcnt capture at crest and/or trough in complementary pwm operation the tcnt value is captured in tgr at either the crest or trough or at both the crest and trough during complementary pwm operation. the timing for capturing in tgr can be selected by tior. figure 10.93 shows an example in which tcnt is used as a free-running counter without being cleared, and the tcnt value is captured in tgr at the specified timing (either crest or trough, or both crest and trough). tdead tdelay upper arm signal lower arm signal inverter output monitor signal dead time delay signal tgra_4 3de7 3e5b 3e5b 3ed3 3ed3 3f37 3f37 3faf 3faf 3de7 tcnt[15:0] tgr[15:0] up-count/down-count signal (udflg) figure 10.93 tcnt capturing at crest and/or trough in complementary pwm operation
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 423 of 1080 rej09b0230-0300 10.5 interrupt sources 10.5.1 interrupt sources and priorities there are three kinds of mtu2 interrupt source; tgr input capture/compare match, tcnt overflow, and tcnt underflow. each interrupt source has its own status flag and enable/disabled bit, allowing the generation of interrupt request signals to be enabled or disabled individually. when an interrupt request is generated, the corresponding status flag in tsr is set to 1. if the corresponding enable/disable bit in tier is set to 1 at this time, an interrupt is requested. the interrupt request is cleared by cl earing the status flag to 0. relative channel priorities can be changed by the interrupt controller, however the priority order within a channel is fixed. for details, s ee section 6, interrupt controller (intc). table 10.60 lists the mtu2 interrupt sources.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 424 of 1080 rej09b0230-0300 table 10.60 mtu2 interrupts channel name interrupt source interrupt flag dtc activation priority 0 tgia_0 tgra_0 input capture/compare match tgfa_0 possible high tgib_0 tgrb_0 input capture/compare match tgfb_0 possible tgic_0 tgrc_0 input capture/compare match tgfc_0 possible tgid_0 tgrd_0 input capture/compare match tgfd_0 possible tciv_0 tcnt_0 overflow tcfv_0 not possible tgie_0 tgre_0 compare match tgfe_0 not possible tgif_0 tgrf_0 compare match tgff_0 not possible 1 tgia_1 tgra_1 input capture/compare match tgfa_1 possible tgib_1 tgrb_1 input capture/compare match tgfb_1 possible tciv_1 tcnt_1 overflow tcfv_1 not possible tciu_1 tcnt_1 underflow tcfu_1 not possible 2 tgia_2 tgra_2 input capture/compare match tgfa_2 possible tgib_2 tgrb_2 input capture/compare match tgfb_2 possible tciv_2 tcnt_2 overflow tcfv_2 not possible tciu_2 tcnt_2 underflow tcfu_2 not possible 3 tgia_3 tgra_3 input capture/compare match tgfa_3 possible tgib_3 tgrb_3 input capture/compare match tgfb_3 possible tgic_3 tgrc_3 input capture/compare match tgfc_3 possible tgid_3 tgrd_3 input capture/compare match tgfd_3 possible tciv_3 tcnt_3 overflow tcfv_3 not possible 4 tgia_4 tgra_4 input capture/compare match tgfa_4 possible tgib_4 tgrb_4 input capture/compare match tgfb_4 possible tgic_4 tgrc_4 input capture/compare match tgfc_4 possible tgid_4 tgrd_4 input capture/compare match tgfd_4 possible tciv_4 tcnt_4 overflow/underflow tcfv_4 possible 5 tgiu_5 tgru_5 input capture/compare match tgfu_5 possible tgiv_5 tgrv_5 input capture/compare match tgfv_5 possible tgiw_5 tgrw_5 input capture/compare match tgfw_5 possible low note: this table shows the initial state immediately after a reset. the relative channel priorities can be changed by the interrupt controller.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 425 of 1080 rej09b0230-0300 input capture/compare match interrupt: an interrupt is requested if the tgie bit in tier is set to 1 when the tgf flag in tsr is set to 1 by the occurrence of a tgr input capture/compare match on a particular channel. the interrupt reques t is cleared by clearing the tgf flag to 0. the mtu2 has 21 input capture/compare match interrupts, six for channel 0, four each for channels 3 and 4, two each for channels 1 and 2, and thr ee for channel 5. the tgfe_0 and tgff_0 flags in channel 0 are not set by the occurrence of an input capture. overflow interrupt: an interrupt is requested if the tciev bit in tier is set to 1 when the tcfv flag in tsr is set to 1 by the occurren ce of tcnt overflow on a channel. the interrupt request is cleared by clearing the tcfv flag to 0. the mtu2 has five overflow interrupts, one for each channel. underflow interrupt: an interrupt is requested if the tcie u bit in tier is set to 1 when the tcfu flag in tsr is set to 1 by the occurrence of tcnt underflow on a channel. the interrupt request is cleared by clearing the tcfu flag to 0. the mtu2 has two underflow interrupts, one each for channels 1 and 2. 10.5.2 dtc activation the dtc can be activated by the tgr input capture /compare match interrupt in each channel or the overflow interrupt in channel 4. for details, see section 8, data transfer controller (dtc). a total of 20 mtu2 input capture/compare match interrupts and overflow interrupts can be used as dtc activation sources, four each for channels 0 and 3, two each for channels 1 and 2, five for channel 4, and three for channel 5.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 426 of 1080 rej09b0230-0300 10.5.3 a/d converter activation the a/d converter can be activated by one of the following three methods in the mtu2. table 10.61 shows the relationship between interrupt sources and a/d converter start request signals. a/d converter activation by tgra input capture/compare match or at tcnt_4 trough in complementary pwm mode: the a/d converter can be ac tivated by the occurrence of a tgra input capture/compare match in each ch annel. in addition, if complementary pwm operation is performed while the ttge2 bit in tier_4 is set to 1, the a/d converter can be activated at the trough of tcnt_4 count (tcnt_4 = h'0000). a/d converter start request signal trgan is issued to the a/d converter under either one of the following conditions. ? when the tgfa flag in tsr is set to 1 by the occurrence of a tgra input capture/compare match on a particular channel while the ttge bit in tier is set to 1 ? when the tcnt_4 count reaches the trough (tcnt_4 = h'0000) during complementary pwm operation while the ttge2 bit in tier_4 is set to 1 when either condition is satisfi ed, if a/d converter start si gnal trgan from the mtu2 is selected as the trigger in the a/d converter, a/d conversion will start. a/d converter activation by compa re match between tcnt_0 and tgre_0: the a/d converter can be activated by generating a/d converter start request signal trg0n when a compare match occurs between tcnt_0 and tgre_0 in channel 0. when the tgfe flag in tsr2_0 is set to 1 by the occurrence of a compare match between tcnt_0 and tgre_0 in channel 0 while the ttge2 bit in tier2_0 is set to 1, a/d converter start request tgr0n is issued to the a/d converter. if a/d converter start signal tgr0n from the mtu2 is selected as the trigger in the a/d converter, a/d conversion will start. a/d converter activation by a/d converter start request delaying function: the a/d converter can be activated by generating a/d co nverter start request signal trg4an or trg4bn when the tcnt_4 count matches the tadcora or tadcorb value if the tad4ae or tad4be bit in the a/d converter start request control register (tadcr) is set to 1. for details, refer to section 10.4.9, a/d converter start request delaying function. a/d conversion will start if a/d converter start signal trg4an from the mtu2 is selected as the trigger in the a/d converter when trg4an is generated or if trg4bn from the mtu2 is selected as the trigger in the a/d converter when trg4bn is generated.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 427 of 1080 rej09b0230-0300 table 10.61 interrupt sources and a/d converter start request signals target registers interrupt source a/d converter start request signal tgra_0 and tcnt_0 tgra_1 and tcnt_1 tgra_2 and tcnt_2 tgra_3 and tcnt_3 tgra_4 and tcnt_4 input capture/compare match tcnt_4 tcnt_4 trough in complementary pwm mode trgan tgre_0 and tcnt_0 trg0n tadcora and tcnt_4 compare match trg4an tadcorb and tcnt_4 trg4bn
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 428 of 1080 rej09b0230-0300 10.6 operation timing 10.6.1 input/output timing tcnt count timing: figures 10.94 and 10.95 show tcnt count timing in internal clock operation, and figure 10.96 shows tcnt count timing in external clock operation (normal mode), and figure 10.97 shows tcnt count timing in external clock operation (phase counting mode). tcnt tcnt input clock internal clock mp falling edge rising edge n - 1 n n + 1 figure 10.94 count timing in internal clock operation (channels 0 to 4) tcnt tcnt input clock internal clock mp rising edge n - 1 n figure 10.95 count timing in internal clock operation (channel 5) mp tcnt tcnt input clock external clock falling edge rising edge n - 1 n n + 1 figure 10.96 count timing in external clock operation (channels 0 to 4)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 429 of 1080 rej09b0230-0300 mp external clock tcnt input clock tcnt rising edge falling edge n - 1 n n - 1 figure 10.97 count timing in external clock operation (phase counting mode) output compare output timing: a compare match signal is generated in the final state in which tcnt and tgr match (the point at which the count value matched by tcnt is updated). when a compare match signal is generated, the output value set in tior is output at the output compare output pin (tioc pin). after a match between tcnt and tgr, the compare match signal is not generated until the tc nt input clock is generated. figure 10.98 shows output compare output timing (normal mode and pwm mode) and figure 10.99 shows output compare output timing (complementary pwm mode and reset synchronous pwm mode). tgr tcnt tcnt input clock n n n + 1 compare match signal tioc pin mp figure 10.98 output compare output timing (normal mode/pwm mode)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 430 of 1080 rej09b0230-0300 tcnt input clock tcnt n n + 1 tgr compare match signal tioc pin n mp figure 10.99 output compare output timing (complementary pwm mode/reset synchronous pwm mode) input capture signal timing: figure 10.100 shows input capture signal timing. tcnt input capture input n n + 1 n + 2 n n + 2 tgr input capture signal mp figure 10.100 input capture input signal timing
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 431 of 1080 rej09b0230-0300 timing for counter clearing by compare match/input capture: figures 10.101 and 10.102 show the timing when counter clearing on compare match is specified, and figure 10.103 shows the timing when counter clearing on input capture is specified. mp tcnt counter clear signal compare match signal tgr n n h'0000 figure 10.101 counter clear timing (compare match) (channels 0 to 4) mp tcnt counter clear signal compare match signal tgr n n - 1 h'0000 figure 10.102 counter clear timing (compare match) (channel 5)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 432 of 1080 rej09b0230-0300 tcnt counter clear signal input capture signal tgr n h'0000 n mp figure 10.103 counter clear timing (input capture) (channels 0 to 5) buffer operation timing: figures 10.104 to 10.106 show the timing in buffer operation. tgra, tgrb compare match buffer signal tcnt tgrc, tgrd n n n n n + 1 mp figure 10.104 buffer operation timing (compare match) tgra, tgrb tcnt input capture signal tgrc, tgrd n n n n + 1 n n n + 1 mp figure 10.105 buffer operation timing (input capture)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 433 of 1080 rej09b0230-0300 tgra, tgrb, tgre tcnt clear signal buffer transfer signal tcnt mp tgrc, tgrd, tgrf n n n n h'0000 figure 10.106 buffer transfer timing (when tcnt cleared) buffer transfer timing (complementary pwm mode) : figures 10.107 to 10.109 show the buffer transfer timing in complementary pwm mode. buffer register tgrd_4 write signal temporary register transfer signal tcnts mp temporary register n n n n h'0000 figure 10.107 transfer timing from buffer register to temporary register (tcnts stop)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 434 of 1080 rej09b0230-0300 buffer register tgrd_4 write signal tcnts mp temporary register n n n n p - x p h'0000 figure 10.108 transfer timing from buffer register to temporary register (tcnts operating) temporary register buffer transfer signal tcnts mp compare register n n n p ? 1 p h'0000 figure 10.109 transfer timing from temporary register to compare register
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 435 of 1080 rej09b0230-0300 10.6.2 interrupt signal timing tgf flag setting timing in case of compare match: figures 10.110 and 10.111 show the timing for setting of the tgf flag in tsr on compare match, and tgi interrupt request signal timing. tgr tcnt tcnt input clock n n n + 1 compare match signal tgf flag tgi interrupt mp figure 10.110 tgi interrupt timing (compare match) (channels 0 to 4) tgr tcnt tcnt input clock n n - 1 n compare match signal tgf flag tgi interrupt mp figure 10.111 tgi interrupt timing (compare match) (channel 5)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 436 of 1080 rej09b0230-0300 tgf flag setting timing in case of input capture: figures 10.112 and 10.113 show the timing for setting of the tgf flag in tsr on input capture, and tgi interrupt request signal timing. tgr tcnt input capture signal n n tgf flag tgi interrupt mp , p figure 10.112 tgi interrupt timing (input capture) (channels 0 to 4) tgr tcnt input capture signal n n tgf flag tgi interrupt mp , p figure 10.113 tgi interrupt timing (input capture) (channel 5)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 437 of 1080 rej09b0230-0300 tcfv flag/tcfu flag setting timing: figure 10.114 shows the timing for setting of the tcfv flag in tsr on overflow, and tciv interrupt request signal timing. figure 10.115 shows the timing for setting of the tcfu flag in tsr on underflow, and tciu interrupt request signal timing. overflow signal tcnt (overflow) tcnt input clock h'ffff h'0000 tcfv flag tciv interrupt mp , p figure 10.114 tciv interrupt setting timing underflow signal tcnt (underflow) tcnt input clock h'0000 h'ffff tcfu flag tciu interrupt mp , p figure 10.115 tciu interrupt setting timing
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 438 of 1080 rej09b0230-0300 status flag clearing timing: after a status flag is read as 1 by the cpu, it is cleared by writing 0 to it. when the dtc is activated, the flag is cleared automatically. figures 10.116 and 10.117 show the timing for status flag clearing by the cpu, and figures 10.118 and 10.119 show the timing for status flag clearing by the dtc. status flag write signal address tsr address interrupt request signal tsr write cycle t1 t2 mp , p figure 10.116 timing for status flag clearing by cpu (channels 0 to 4) status flag write signal address tsr address interrupt request signal tsr write cycle t1 t2 mp , p figure 10.117 timing for status flag clearing by cpu (channel 5)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 439 of 1080 rej09b0230-0300 interrupt request signal flag clear signal status flag address source address dtc read cycle destination address dtc write cycle mp , p , b figure 10.118 timing for status flag clearing by dtc activation (channels 0 to 4) interrupt request signal flag clear signal status flag address source address dtc read cycle destination address dtc write cycle mp , p , b figure 10.119 timing for status flag clearing by dtc activation (channel 5)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 440 of 1080 rej09b0230-0300 10.7 usage notes 10.7.1 module standby mode setting mtu2 operation can be disabled or enabled using the standby control register. the initial setting is for mtu2 operation to be halted. register access is enabled by clearing module standby mode. for details, refer to section 22, power-down modes. 10.7.2 input clock restrictions the input clock pulse width must be at least 1.5 states in the case of single-edge detection, and at least 2.5 states in the case of both-edge detecti on. the mtu2 will not operate properly at narrower pulse widths. in phase counting mode, the phase difference and overlap between the two input clocks must be at least 1.5 states, and the pulse width must be at least 2.5 states. figure 10.120 shows the input clock conditions in phase counting mode. overlap phase differ- ence phase differ- ence overlap tclka (tclkc) tclkb (tclkd) pulse width pulse width pulse width pulse width notes: phase difference and overlap pulse width : 1.5 states or more : 2.5 states or more figure 10.120 phase differ ence, overlap, and pulse widt h in phase counting mode
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 441 of 1080 rej09b0230-0300 10.7.3 caution on period setting when counter clearing on compare match is set, tcnt is cleared in the final state in which it matches the tgr value (the point at which the count value matched by tcnt is updated). consequently, the actual counter frequency is given by the following formula: ? channels 0 to 4 f = mp (n + 1) ? channel 5 f = mp n where f: counter frequency mp : mtu2 peripheral clock operating frequency n: tgr set value 10.7.4 contention between tcnt write and clear operations if the counter clear signal is generated in the t2 state of a tcnt write cycle, tcnt clearing takes precedence and the tcnt write is not performed. figure 10.121 shows the timing in this case. counter clear signal write signal address tcnt address tcnt tcnt write cycle t1 t2 n h'0000 mp figure 10.121 contention between tcnt write and clear operations
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 442 of 1080 rej09b0230-0300 10.7.5 contention between tcnt wr ite and increment operations if incrementing occurs in the t2 state of a tcnt write cycle, the tcnt write takes precedence and tcnt is not incremented. figure 10.122 shows the timing in this case. tcnt input clock write signal address tcnt address tcnt tcnt write cycle t1 t2 nm tcnt write data mp figure 10.122 contention between tcnt write and increment operations
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 443 of 1080 rej09b0230-0300 10.7.6 contention between tgr write and compare match if a compare match occurs in the t2 state of a tg r write cycle, the tgr write is executed and the compare match signal is also generated. figure 10.123 shows the timing in this case. compare match signal write signal address tgr address tcnt tgr write cycle t1 t2 nm tgr write data tgr n n + 1 mp figure 10.123 contention betw een tgr write and compare match
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 444 of 1080 rej09b0230-0300 10.7.7 contention between buffer regi ster write and compare match if a compare match occurs in the t2 state of a tgr write cycle, the data that is transferred to tgr by the buffer operation is the data before write. figure 10.124 shows the timing in this case. address write signal compare match signal compare match buffer signal tgr write cycle t1 t2 buffer register address n n m buffer register write data buffer register tgr mp figure 10.124 contention between bu ffer register write and compare match
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 445 of 1080 rej09b0230-0300 10.7.8 contention between buffer re gister write and tcnt clear when the buffer transfer timing is set at the tc nt clear by the buffer transfer mode register (tbtm), if tcnt clear occurs in th e t2 state of a tgr write cycle, the data that is transferred to tgr by the buffer operation is the data before write. figure 10.125 shows the timing in this case. address write signal tcnt clear signal buffer transfer signal tgr write cycle t1 t2 buffer register address n n m buffer register write data buffer register tgr mp figure 10.125 contention between buffer register write and tcnt clear
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 446 of 1080 rej09b0230-0300 10.7.9 contention between tgr read and input capture if an input capture signal is generated in the t1 state of a tgr read cycle, the data that is read will be the data in the buffer before input capture transfer for channels 0 to 4, and the data after input capture transfer for channel 5. figures 10.126 and 10.127 show the timing in this case. input capture signal read signal address tgr read cycle t1 t2 tgr internal data bus tgr address mp n n m figure 10.126 contention between tgr read and input capture (channels 0 to 4) input capture signal read signal address tgr read cycle t1 t2 tgr internal data bus tgr address mp m nm figure 10.127 contention between tgr read and input capture (channel 5)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 447 of 1080 rej09b0230-0300 10.7.10 contention between tgr write and input capture if an input capture signal is generated in the t2 state of a tgr write cycle, the input capture operation takes precedence and the write to tgr is not performed for channels 0 to 4. for channel 5, write to tgr is performed and th e input capture signal is generated. figures 10.128 and 10.129 show the timing in this case. input capture signal write signal address tcnt tgr write cycle t1 t2 m tgr m tgr address mp figure 10.128 contention between tgr write and input capture (channels 0 to 4) input capture signal write signal address tcnt tgr write cycle t1 t2 n tgr m tgr address mp tgr write data figure 10.129 contention between tgr write and input capture (channel 5)
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 448 of 1080 rej09b0230-0300 10.7.11 contention between buffer regi ster write and input capture if an input capture signal is generated in the t2 state of a buffer register write cycle, the buffer operation takes precedence and the write to the buffer register is not performed. figure 10.130 shows the timing in this case. input capture signal write signal address tcnt buffer register write cycle t1 t2 n tgr n m m buffer register buffer register address mp figure 10.130 contention between buffer register write and input capture 10.7.12 tcnt_2 write and overflow/ underflow contention in cascade connection with timer counters tcnt_1 and tcnt_2 in a cascade connection, when a contention occurs during tcnt_1 count (during a tcnt_2 overflow/underflow) in the t2 state of the tcnt_2 write cycle, the write to tcnt_2 is conducted, and the tcnt_1 count signal is disabled. at this point, if there is match with tgra_1 and the tcnt_1 value, a compare signal is issued. furthermore, when the tcnt_1 count clock is selected as the input capture source of channel 0, tgra_0 to tgrd_0 carry out the input capture operation. in addition, when the compare match/input capture is selected as the input capture source of tgrb_1, tgrb_1 carries out input capture operation. the timing is shown in figure 10.131. for cascade connections, be sure to synchronize settings for channels 1 and 2 when setting tcnt clearing.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 449 of 1080 rej09b0230-0300 t1 t2 h'fffe h'ffff n n + 1 h'ffff m m n p qp m disabled tcnt_2 write data tcnt_2 address tcnt write cycle address write signal tcnt_2 tgra_2 to tgrb_2 ch2 compare- match signal a/b tcnt_1 input clock tcnt_1 tgra_1 ch1 compare- match signal a tgrb_1 ch1 input capture signal b tcnt_0 tgra_0 to tgrd_0 ch0 input capture signal a to d mp figure 10.131 tcnt_2 write and overflow/underflow contention with cascade connection
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 450 of 1080 rej09b0230-0300 10.7.13 counter value during complementary pwm mode stop when counting operation is suspended with tcnt_3 and tcnt_4 in complementary pwm mode, tcnt_3 has the timer dead time register (tddr) value, and tcnt_4 is held at h'0000. when restarting complementary pwm mode, counting begins automatically from the initialized state. this explanatory diagram is shown in figure 10.132. when counting begins in another operating mode , be sure that tcnt_3 and tcnt_4 are set to the initial values. tgra_3 tcdr tddr h'0000 tcnt_3 tcnt_4 complementary pwm mode operation complementary pwm mode operation counter operation stop complementary pmw restart figure 10.132 counter value during complementary pwm mode stop 10.7.14 buffer operation setting in complementary pwm mode in complementary pwm mode, conduct rewrites by buffer operation for the pwm cycle setting register (tgra_3), timer cycle data register (tcdr), and duty setting registers (tgrb_3, tgra_4, and tgrb_4). in complementary pwm mode, channel 3 and channel 4 buffers operate in accordance with bit settings bfa and bfb of tmdr_3. when tmdr_3's bfa bit is set to 1, tgrc_3 functions as a buffer register for tgra_3. at the same time, tgrc_4 functions as the buffer register for tgra_4, and tcbr functions as the tcdr's buffer register.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 451 of 1080 rej09b0230-0300 10.7.15 reset sync pwm mode buffer operation and compare match flag when setting buffer operation for reset sync pwm mode, set the bfa and bfb bits in tmdr_4 to 0. the tioc4c pin will be unable to produce its waveform output if the bfa bit in tmdr_4 is set to 1. in reset sync pwm mode, the channel 3 and channe l 4 buffers operate in accordance with the bfa and bfb bit settings of tmdr_3. for example, if the bfa bit in tmdr_3 is set to 1, tgrc_3 functions as the buffer register for tgra_3. at the same time, tgrc_4 functions as the buffer register for tgra_4. the tgfc bit and tgfd bit in tsr_3 and tsr_4 are not set when tgrc_3 and tgrd_3 are operating as buffer registers. figure 10.133 shows an example of operations for tgr_3, tgr_4, tioc3, and tioc4, with tmdr_3's bfa and bfb bits set to 1, and tmdr_4's bfa and bfb bits set to 0. tgra_3 tgrc_3 tgrb_3, tgra_4, tgrb_4 tgrd_3, tgrc_4, tgrd_4 h'0000 tioc3a tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d tgfc tgfd tgra_3, tgrc_3 tgrb_3, tgrd_3, tgra_4, tgrc_4, tgrb_4, tgrd_4 buffer transfer with compare match a3 tcnt3 not set not set point a point b figure 10.133 buffer operation and compare-match flags in reset synchronous pwm mode
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 452 of 1080 rej09b0230-0300 10.7.16 overflow flags in reset synchronous pwm mode when set to reset synchronous pwm mode, tcnt_3 and tcnt_4 start counting when the cst3 bit of tstr is set to 1. at this point, tcnt_4's count clock source and count edge obey the tcr_3 setting. in reset synchronous pwm mode, with cycle register tgra_3's set value at h'ffff, when specifying tgr3a compare-match for the counter clear source, tcnt_3 and tcnt_4 count up to h'ffff, then a compare-match occurs with tgra_3, and tcnt_3 and tcnt_4 are both cleared. at this point, tsr's overfl ow flag tcfv bit is not set. figure 10.134 shows a tcfv bit operation example in reset synchronous pwm mode with a set value for cycle register tgra_3 of h'ffff, when a tgra_3 compare-match has been specified without synchronous setting fo r the counter clear source. tgra_3 (h'ffff) h'0000 tcfv_3 tcfv_4 tcnt_3 = tcnt_4 counter cleared by compare match 3a not set not set figure 10.134 reset synchronous pwm mode overflow flag
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 453 of 1080 rej09b0230-0300 10.7.17 contention between overflow/u nderflow and co unter clearing if overflow/underflow and counter clearing occur simultaneously, the tcfv/tcfu flag in tsr is not set and tcnt clearing takes precedence. figure 10.135 shows the operation timing when a tg r compare match is specified as the clearing source, and when h'ffff is set in tgr. counter clear signal tcnt tcnt input clock h'ffff h'0000 tgf tcfv disabled mp figure 10.135 contention betw een overflow and counter clearing
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 454 of 1080 rej09b0230-0300 10.7.18 contention between tcnt wr ite and overflo w/underflow if there is an up-count or down-count in the t2 state of a tcnt write cycle, and overflow/underflow occurs, the tcnt write takes precedence and the tcfv/t cfu flag in tsr is not set. figure 10.136 shows the operation timing when there is contention between tcnt write and overflow. disabled write signal address tcnt address tcnt tcnt write cycle t1 t2 h'ffff m tcnt write data tcfv flag mp figure 10.136 contention be tween tcnt write and overflow 10.7.19 cautions on transition from normal operation or pwm mode 1 to reset- synchronized pwm mode when making a transition from channel 3 or 4 normal operation or pwm mode 1 to reset- synchronized pwm mode, if the counter is halted with the output pins (tioc3b, tioc3d, tioc4a, tioc4c, tioc4b, tioc4d) in the high-lev el state, followed by the transition to reset- synchronized pwm mode and operation in that mode, the initial pin output will not be correct. when making a transition from normal operation to reset-synchronized pwm mode, write h'11 to registers tiorh_3, tiorl_3, tiorh_4, and tior l_4 to initialize the output pins to low level output, then set an initial register value of h'00 before making the mode transition. when making a transition from pwm mode 1 to reset-synchronized pwm mode, first switch to normal operation, then initialize the output pins to low level output and set an initial register value of h'00 before making the transition to reset-synchronized pwm mode.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 455 of 1080 rej09b0230-0300 10.7.20 output level in complementary pwm mo de and reset-synchronized pwm mode when channels 3 and 4 are in complementary pwm mode or reset-synchronized pwm mode, the pwm waveform output level is set with the olsp and olsn bits in the timer output control register (tocr). in the case of complementary pwm mode or reset-synchronized pwm mode, tior should be set to h'00. 10.7.21 interrupts in module standby mode if module standby mode is entered when an interrupt has been requested, it will not be possible to clear the cpu interrupt source or the dtc activation source. interrupts should therefore be disabled before entering module standby mode. 10.7.22 simultaneous capture of tcnt_1 and tcnt_2 in cascade connection when timer counters 1 and 2 (tcnt_1 and tcnt_2) are operated as a 32-bit counter in cascade connection, the cascade counter value cannot be captured successfully even if input-capture input is simultaneously done to tioc1a and tioc2a or to tioc1b and tioc2b. this is because the input timing of tioc1a and tioc2a or of tioc1b and tioc2b may not be the same when external input-capture signals to be input into tcnt_1 and tcnt_2 are taken in synchronization with the internal clock. for example, tcnt_1 (the counter for upper 16 bits) does not capture the count-up value by overflow from tcnt_2 (the counter for lower 16 bits) but captures the count value before the count-up. in this case, the values of tcnt_1 = h'fff1 and tcnt_2 = h'0000 should be transferred to tgra_1 and tgra_2 or to tgrb_1 and tgrb_2, but the values of tcnt_1 = h'fff0 and tcnt _2 = h'0000 are erroneously transferred. the mtu2 has a new function that allows simultaneous capture of tcnt_1 and tcnt_2 with a single input-capture input as the trigger. this function allows reading of the 32-bit counter such that tcnt_1 and tcnt_2 are captured at the same time. for details, see section, 10.3.8, timer input capture control register (ti ccr). 10.7.23 buffer register flag bits in complementary pwm mode in complementary pwm modes 1 to 3 of the mt u2 or mtu2s, when compare match with a timer general register (tgr) that is configured for buffer operation occurs, the corresponding bit (tgfc for buffer operation a and tgfd for buffer operation b) in the timer status register (tsr) is set to 1. to suppress generation of interrupts on compare match with a tgr specified for buffer operation, the corresponding bit in the timer interrupt enable register (tier) for the tgr specified for buffer operation should be cleared.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 456 of 1080 rej09b0230-0300 10.8 mtu2 output pin initialization 10.8.1 operating modes the mtu2 has the following six operating modes. waveform output is possible in all of these modes. ? normal mode (channels 0 to 4) ? pwm mode 1 (channels 0 to 4) ? pwm mode 2 (channels 0 to 2) ? phase counting modes 1 to 4 (channels 1 and 2) ? complementary pwm mode (channels 3 and 4) ? reset-synchronized pwm mode (channels 3 and 4) the mtu2 output pin initialization method for each of these modes is described in this section. 10.8.2 reset start operation the mtu2 output pins (tioc*) are initialized low by a reset and in standby mode. since mtu2 pin function selection is performed by the pin function controller (pfc), when the pfc is set, the mtu2 pin states at that point are output to the ports. when mtu2 output is selected by the pfc immediately after a reset, the mtu2 output initial level, low, is output directly at the port. when the active level is low, the syst em will operate at this point, a nd therefore the pfc setting should be made after initialization of the mtu2 output pins is completed. note: channel number and port notation are substituted for *.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 457 of 1080 rej09b0230-0300 10.8.3 operation in case of re-setting du e to error during operation, etc. if an error occurs during mtu2 operation, mtu2 output should be cut by the system. cutoff is performed by switching the pin output to port output with the pfc and outputting the inverse of the active level. for large-current pins, output can also be cut by hardware, using port output enable (poe). the pin initialization procedures for re-setting due to an error during operation, etc., and the procedures for restarting in a different mode after re-setting, are shown below. the mtu2 has six operating modes, as stat ed above. there are thus 36 mode transition combinations, but some transitions are not available with certain channel and mode combinations. possible mode transition combinations are shown in table 10.62. table 10.62 mode transition combinations after before normal pwm1 pwm2 pcm cpwm rpwm normal (1) (2) (3) (4) (5) (6) pwm1 (7) (8) (9) (10) (11) (12) pwm2 (13) (14) (15) (16) none none pcm (17) (18) (19) (20) none none cpwm (21) (22) none none (23) (24) (25) rpwm (26) (27) none none (28) (29) [legend] normal: normal mode pwm1: pwm mode 1 pwm2: pwm mode 2 pcm: phase counting modes 1 to 4 cpwm: complementary pwm mode rpwm: reset-synchronized pwm mode
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 458 of 1080 rej09b0230-0300 10.8.4 overview of initialization procedures and mode transitions in case of error during operation, etc. ? when making a transition to a mode (normal, pwm1, pwm2, pcm) in which the pin output level is selected by the timer i/o control register (tior) setting, initialize the pins by means of a tior setting. ? in pwm mode 1, since a waveform is not output to the tioc*b (tioc *d) pin, setting tior will not initialize the pins. if initialization is required, carry it out in normal mode, then switch to pwm mode 1. ? in pwm mode 2, since a waveform is not output to the cycle register pin, setting tior will not initialize the pins. if initialization is required, carry it out in normal mode, then switch to pwm mode 2. ? in normal mode or pwm mode 2, if tgrc and tgrd operate as buffer registers, setting tior will not initialize the buffer register pins. if initialization is required, clear buffer mode, carry out initialization, then set buffer mode again. ? in pwm mode 1, if either tgrc or tgrd operates as a buffer register, setting tior will not initialize the tgrc pin. to initialize the tgrc pin, clear buffer mode, carry out initialization, then set buffer mode again. ? when making a transition to a mode (cpwm, rpwm) in which the pin output level is selected by the timer output control register (tocr) setting, switch to normal mode and perform initialization with tior, then restore tior to its initial value, and temporarily disable channel 3 and 4 output with the timer output mast er enable register (t oer). then operate the unit in accordance with the mode setting procedure (tocr setting, tmdr setting, toer setting). note: channel number is substituted for * indicated in this article. pin initialization procedures are described below for the numbered combinations in table 10.62. the active level is assumed to be low.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 459 of 1080 rej09b0230-0300 operation when error occurs during normal mode operation, and operation is restarted in normal mode: figure 10.137 shows an explanatory diag ram of the case where an error occurs in normal mode and operation is restar ted in normal mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen n = 0 to 15 hi-z hi-z figure 10.137 error occu rrence in normal mode, r ecovery in normal mode 1. after a reset, mtu2 output is low a nd ports are in the high-impedance state. 2. after a reset, the tmdr setting is for normal mode. 3. for channels 3 and 4, enable output with toer before initializing the pins with tior. 4. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence.) 5. set mtu2 output with the pfc. 6. the count operation is started by tstr. 7. output goes low on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. 11. not necessary when restarting in normal mode. 12. initialize the pins with tior. 13. set mtu2 output with the pfc. 14. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 460 of 1080 rej09b0230-0300 operation when error occurs during normal mode operation, and operation is restarted in pwm mode 1: figure 10.138 shows an explanatory diag ram of the case where an error occurs in normal mode and operation is restar ted in pwm mode 1 after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (tioc * b) n = 0 to 15 hi-z hi-z figure 10.138 error occurrence in no rmal mode, recovery in pwm mode 1 1 to 10 are the same as in figure 10.137. 11. set pwm mode 1. 12. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized. if initialization is required, initialize in normal mode, then switch to pwm mode 1.) 13. set mtu2 output with the pfc. 14. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 461 of 1080 rej09b0230-0300 operation when error occurs during normal mode operation, and operation is restarted in pwm mode 2: figure 10.139 shows an explanatory diag ram of the case where an error occurs in normal mode and operation is restar ted in pwm mode 2 after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm2) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (cycle re g ister) n = 0 to 15 hi-z hi-z figure 10.139 error occurrence in no rmal mode, recovery in pwm mode 2 1 to 10 are the same as in figure 10.137. 11. set pwm mode 2. 12. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized. if initialization is required, initialize in normal mode, then switch to pwm mode 2.) 13. set mtu2 output with the pfc. 14. operation is restarted by tstr. note: pwm mode 2 can only be set for channels 0 to 2, and therefore toer setting is not necessary.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 462 of 1080 rej09b0230-0300 operation when error occurs during normal mode operation, and operation is restarted in phase counting mode: figure 10.140 shows an explanatory diagram of the case where an error occurs in normal mode and operation is rest arted in phase counting mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pcm) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen n = 0 to 15 hi-z hi-z figure 10.140 error occur rence in normal mode, recov ery in phase counting mode 1 to 10 are the same as in figure 10.137. 11. set phase counting mode. 12. initialize the pins with tior. 13. set mtu2 output with the pfc. 14. operation is restarted by tstr. note: phase counting mode can only be set for channels 1 and 2, and therefore toer setting is not necessary.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 463 of 1080 rej09b0230-0300 operation when error occurs during normal mode operation, and operation is restarted in complementary pwm mode: figure 10.141 shows an explanat ory diagram of the case where an error occurs in normal mode and operation is restarted in complementary pwm mode after re- setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tior (0 init 0 out) 12 tior ( disabled ) 13 toer (0) 14 tocr 15 tmdr (cpwm) 16 toer (1) 17 pfc (mtu2) 18 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 hi-z hi-z hi-z figure 10.141 error occu rrence in normal mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.137. 11. initialize the normal mode waveform generation section with tior. 12. disable operation of the normal mode waveform generation section with tior. 13. disable channel 3 and 4 output with toer. 14. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 15. set complementary pwm. 16. enable channel 3 and 4 output with toer. 17. set mtu2 output with the pfc. 18. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 464 of 1080 rej09b0230-0300 operation when error occurs during normal mode operation, and operation is restarted in reset-synchronized pwm mode: figure 10.142 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in reset-synchronized pwm mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tior (0 init 0 out) 12 tior ( disabled ) 13 toer (0) 14 tocr 15 tmdr (rpwm) 16 toer (1) 17 pfc (mtu2) 18 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 hi-z hi-z hi-z figure 10.142 error occu rrence in normal mode, recovery in reset-synchronized pwm mode 1 to 13 are the same as in figure 10.137. 14. select the reset-synchronized pwm output level and cyclic output enabling/disabling with tocr. 15. set reset-synchronized pwm. 16. enable channel 3 and 4 output with toer. 17. set mtu2 output with the pfc. 18. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 465 of 1080 rej09b0230-0300 operation when error occurs during pwm mode 1 operation, and operation is restarted in normal mode: figure 10.143 shows an explanatory diagra m of the case where an error occurs in pwm mode 1 and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (tioc * b) n = 0 to 15 hi-z hi-z figure 10.143 error occu rrence in pwm mode 1, r ecovery in normal mode 1. after a reset, mtu2 output is low a nd ports are in the high-impedance state. 2. set pwm mode 1. 3. for channels 3 and 4, enable output with toer before initializing the pins with tior. 4. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence. in pwm mode 1, the tioc*b side is not initialized.) 5. set mtu2 output with the pfc. 6. the count operation is started by tstr. 7. output goes low on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. 11. set normal mode. 12. initialize the pins with tior. 13. set mtu2 output with the pfc. 14. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 466 of 1080 rej09b0230-0300 operation when error occurs during pwm mode 1 operation, and operation is restarted in pwm mode 1: figure 10.144 shows an explanatory diag ram of the case where an error occurs in pwm mode 1 and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (tioc * b) not initialized (tioc * b) n = 0 to 15 hi-z hi-z figure 10.144 error occu rrence in pwm mode 1, recovery in pwm mode 1 1 to 10 are the same as in figure 10.143. 11. not necessary when restarting in pwm mode 1. 12. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized.) 13. set mtu2 output with the pfc. 14. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 467 of 1080 rej09b0230-0300 operation when error occurs during pwm mode 1 operation, and operation is restarted in pwm mode 2: figure 10.145 shows an explanatory diag ram of the case where an error occurs in pwm mode 1 and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm2) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (tioc * b) not initialized (cycle re g ister) n = 0 to 15 hi-z hi-z figure 10.145 error occu rrence in pwm mode 1, recovery in pwm mode 2 1 to 10 are the same as in figure 10.143. 11. set pwm mode 2. 12. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 13. set mtu2 output with the pfc. 14. operation is restarted by tstr. note: pwm mode 2 can only be set for channels 0 to 2, and therefore toer setting is not necessary.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 468 of 1080 rej09b0230-0300 operation when error occurs during pwm mode 1 operation, and operation is restarted in phase counting mode: figure 10.146 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pcm) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (tioc * b) n = 0 to 15 hi-z hi-z figure 10.146 error occur rence in pwm mode 1, recov ery in phase counting mode 1 to 10 are the same as in figure 10.143. 11. set phase counting mode. 12. initialize the pins with tior. 13. set mtu2 output with the pfc. 14. operation is restarted by tstr. note: phase counting mode can only be set for channels 1 and 2, and therefore toer setting is not necessary.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 469 of 1080 rej09b0230-0300 operation when error occurs during pwm mode 1 operation, and operation is restarted in complementary pwm mode: figure 10.147 shows an explanat ory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in complementary pwm mode after re- setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (0 init 0 out) 13 tior ( disabled ) 14 toer (0) 15 tocr 16 tmdr (cpwm) 17 toer (1) 18 pfc (mtu2) 19 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 not initialized (tioc3b) not initialized (tioc3d) hi-z hi-z hi-z figure 10.147 error occu rrence in pwm mode 1, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.143. 11. set normal mode for initialization of the normal mode waveform generation section. 12. initialize the pwm mode 1 waveform generation section with tior. 13. disable operation of the pwm mode 1 waveform generation section with tior. 14. disable channel 3 and 4 output with toer. 15. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 16. set complementary pwm. 17. enable channel 3 and 4 output with toer. 18. set mtu2 output with the pfc. 19. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 470 of 1080 rej09b0230-0300 operation when error occurs during pwm mode 1 operation, and operation is restarted in reset-synchronized pwm mode: figure 10.148 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in reset-synchronized pwm mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu2) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (0 init 0 out) 13 tior ( disabled ) 14 toer (0) 15 tocr 16 tmdr (rpwm) 17 toer (1) 18 pfc (mtu2) 19 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 not initialized (tioc3b) not initialized (tioc3d) hi-z hi-z hi-z figure 10.148 error occu rrence in pwm mode 1, recovery in reset-synchronized pwm mode 1 to 14 are the same as in figure 10.147. 15. select the reset-synchronized pwm output level and cyclic output enabling/disabling with tocr. 16. set reset-synchronized pwm. 17. enable channel 3 and 4 output with toer. 18. set mtu2 output with the pfc. 19. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 471 of 1080 rej09b0230-0300 operation when error occurs during pwm mode 2 operation, and operation is restarted in normal mode: figure 10.149 shows an explanatory diagra m of the case where an error occurs in pwm mode 2 and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu2) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (normal) 11 tior (1 init 0 out) 12 pfc (mtu2) 13 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (cycle re g ister) n = 0 to 15 hi-z hi-z figure 10.149 error occu rrence in pwm mode 2, r ecovery in normal mode 1. after a reset, mtu2 output is low a nd ports are in the high-impedance state. 2. set pwm mode 2. 3. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence. in pwm mode 2, the cycle register pins are not initialized. in the example, tioc *a is the cycle register.) 4. set mtu2 output with the pfc. 5. the count operation is started by tstr. 6. output goes low on compare-match occurrence. 7. an error occurs. 8. set port output with the pfc and output the inverse of the active level. 9. the count operation is stopped by tstr. 10. set normal mode. 11. initialize the pins with tior. 12. set mtu2 output with the pfc. 13. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 472 of 1080 rej09b0230-0300 operation when error occurs during pwm mode 2 operation, and operation is restarted in pwm mode 1: figure 10.150 shows an explanatory diagra m of the case where an error occurs in pwm mode 2 and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu2) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm1) 11 tior (1 init 0 out) 12 pfc (mtu2) 13 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (tioc * b) not initialized (cycle re g ister) n = 0 to 15 hi-z hi-z figure 10.150 error occu rrence in pwm mode 2, recovery in pwm mode 1 1 to 9 are the same as in figure 10.149. 10. set pwm mode 1. 11. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized.) 12. set mtu2 output with the pfc. 13. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 473 of 1080 rej09b0230-0300 operation when error occurs during pwm mode 2 operation, and operation is restarted in pwm mode 2: figure 10.151 shows an explanatory diag ram of the case where an error occurs in pwm mode 2 and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu2) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm2) 11 tior (1 init 0 out) 12 pfc (mtu2) 13 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (cycle re g ister) not initialized (cycle re g ister) n = 0 to 15 hi-z hi-z figure 10.151 error occu rrence in pwm mode 2, recovery in pwm mode 2 1 to 9 are the same as in figure 10.149. 10. not necessary when restarting in pwm mode 2. 11. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 12. set mtu2 output with the pfc. 13. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 474 of 1080 rej09b0230-0300 operation when e rror occurs during: pwm mode 2 operation, and operation is restarted in phase counting mode figure 10.152 shows an explanatory diagram of the case where an error occurs in pwm mode 2 and operation is restar ted in phase counting mode after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu2) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pcm) 11 tior (1 init 0 out) 12 pfc (mtu2) 13 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (cycle re g ister) n = 0 to 15 hi-z hi-z figure 10.152 error occur rence in pwm mode 2, recov ery in phase counting mode 1 to 9 are the same as in figure 10.149. 10. set phase counting mode. 11. initialize the pins with tior. 12. set mtu2 output with the pfc. 13. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 475 of 1080 rej09b0230-0300 operation when error occurs during phase counting mode operation, and operation is restarted in normal mode: figure 10.153 shows an explanator y diagram of the case where an error occurs in phase counting mode and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu2) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (normal) 11 tior (1 init 0 out) 12 pfc (mtu2) 13 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen n = 0 to 15 hi-z hi-z figure 10.153 error occur rence in phase counting mode, recovery in normal mode 1. after a reset, mtu2 output is low a nd ports are in the high-impedance state. 2. set phase counting mode. 3. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence.) 4. set mtu2 output with the pfc. 5. the count operation is started by tstr. 6. output goes low on compare-match occurrence. 7. an error occurs. 8. set port output with the pfc and output the inverse of the active level. 9. the count operation is stopped by tstr. 10. set in normal mode. 11. initialize the pins with tior. 12. set mtu2 output with the pfc. 13. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 476 of 1080 rej09b0230-0300 operation when error occurs during phase counting mode operation, and operation is restarted in pwm mode 1: figure 10.154 shows an explanator y diagram of the case where an error occurs in phase counting mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu2) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm1) 11 tior (1 init 0 out) 12 pfc (mtu2) 13 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen not initialized (tioc * b) n = 0 to 15 hi-z hi-z figure 10.154 error occur rence in phase counting mode, recovery in pwm mode 1 1 to 9 are the same as in figure 10.153. 10. set pwm mode 1. 11. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 12. set mtu2 output with the pfc. 13. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 477 of 1080 rej09b0230-0300 operation when error occurs during phase counting mode operation, and operation is restarted in pwm mode 2: figure 10.155 shows an explanator y diagram of the case where an error occurs in phase counting mode and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu2) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm2) 11 tior (1 init 0 out) 12 pfc (mtu2) 13 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen n = 0 to 15 hi-z hi-z not initialized (cycle re g ister) figure 10.155 error occur rence in phase counting mode, recovery in pwm mode 2 1 to 9 are the same as in figure 10.153. 10. set pwm mode 2. 11. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 12. set mtu2 output with the pfc. 13. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 478 of 1080 rej09b0230-0300 operation when error occurs during phase counting mode operation, and operation is restarted in phase counting mode: figure 10.156 shows an explanatory diagram of the case where an error occurs in phase counting mode and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu2) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pcm) 11 tior (1 init 0 out) 12 pfc (mtu2) 13 tstr (1) mtu2 module output tioc * a tioc * b port output pen pen n = 0 to 15 hi-z hi-z figure 10.156 error occur rence in phase counting mode, recovery in phase counting mode 1 to 9 are the same as in figure 10.153. 10. not necessary when restarting in phase counting mode. 11. initialize the pins with tior. 12. set mtu2 output with the pfc. 13. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 479 of 1080 rej09b0230-0300 operation when error occu rs during complementary pwm mode operation, and operation is restarted in normal mode: figure 10.157 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in normal mode after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu2) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 hi-z hi-z hi-z figure 10.157 error occurren ce in complementary pwm mode, recovery in normal mode 1. after a reset, mtu2 output is low a nd ports are in the high-impedance state. 2. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 3. set complementary pwm. 4. enable channel 3 and 4 output with toer. 5. set mtu2 output with the pfc. 6. the count operation is started by tstr. 7. the complementary pwm waveform is output on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. (mtu2 output becomes the complementary pwm output initial value.) 11. set normal mode. (mtu2 output goes low.) 12. initialize the pins with tior. 13. set mtu2 output with the pfc. 14. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 480 of 1080 rej09b0230-0300 operation when error occu rs during complementary pwm mode operation, and operation is restarted in pwm mode 1: figure 10.158 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu2) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 not initialized (tioc3b) not initialized (tioc3d) hi-z hi-z hi-z figure 10.158 error occurren ce in complementary pwm mode, recovery in pwm mode 1 1 to 10 are the same as in figure 10.157. 11. set pwm mode 1. (mtu2 output goes low.) 12. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 13. set mtu2 output with the pfc. 14. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 481 of 1080 rej09b0230-0300 operation when error occu rs during complementary pwm mode operation, and operation is restarted in complementary pwm mode: figure 10.159 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in complementary pwm mode after re-setting (when operation is restarted using the cycle and duty settings at the time the counter was stopped). 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu2) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 pfc (mtu2) 12 tstr (1) 13 match mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 hi-z hi-z hi-z figure 10.159 error occurren ce in complementary pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.157. 11. set mtu2 output with the pfc. 12. operation is restarted by tstr. 13. the complementary pwm waveform is output on compare-match occurrence.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 482 of 1080 rej09b0230-0300 operation when error occu rs during complementary pwm mode operation, and operation is restarted in complementary pwm mode: figure 10.160 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in complementary pwm mode after re-setting (when operation is restarted using completely new cycle and duty settings). 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu2) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 toer (0) 13 tocr 14 tmdr (cpwm) 15 toer (1) 16 pfc (mtu2) 17 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 hi-z hi-z hi-z figure 10.160 error occurren ce in complementary pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.157. 11. set normal mode and make new settings. (mtu2 output goes low.) 12. disable channel 3 and 4 output with toer. 13. select the complementary pwm mode output level and cyclic output enabling/disabling with tocr. 14. set complementary pwm. 15. enable channel 3 and 4 output with toer. 16. set mtu2 output with the pfc. 17. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 483 of 1080 rej09b0230-0300 operation when error occu rs during complementary pwm mode operation, and operation is restarted in reset-synchronized pwm mode: figure 10.161 shows an explanatory diagram of the case where an er ror occurs in complementary pwm mode and operation is restarted in reset-synchronized pwm mode. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu2) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 toer (0) 13 tocr 14 tmdr (rpwm) 15 toer (1) 16 pfc (mtu2) 17 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 hi-z hi-z hi-z figure 10.161 error occurren ce in complementary pwm mode, recovery in reset-syn chronized pwm mode 1 to 10 are the same as in figure 10.157. 11. set normal mode. (mtu2 output goes low.) 12. disable channel 3 and 4 output with toer. 13. select the reset-synchronized pwm mode output level and cyclic output enabling/disabling with tocr. 14. set reset-synchronized pwm. 15. enable channel 3 and 4 output with toer. 16. set mtu2 output with the pfc. 17. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 484 of 1080 rej09b0230-0300 operation when error occurs during reset-synchronized pwm mode operation, and operation is restarted in normal mode: figure 10.162 shows an explanatory diagram of the case where an error occurs in reset-synchronized pwm mode and operation is restarted in normal mode after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu2) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 hi-z hi-z hi-z figure 10.162 error occurrence in reset-synchronized pwm mode, recovery in normal mode 1. after a reset, mtu2 output is low a nd ports are in the high-impedance state. 2. select the reset-synchronized pwm output level and cyclic output enabling/disabling with tocr. 3. set reset-synchronized pwm. 4. enable channel 3 and 4 output with toer. 5. set mtu2 output with the pfc. 6. the count operation is started by tstr. 7. the reset-synchronized pwm waveform is output on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. (mtu2 output becomes the reset-synchronized pwm output initial value.) 11. set normal mode. (mtu2 positive phase output is low, and negative phase output is high.) 12. initialize the pins with tior. 13. set mtu2 output with the pfc. 14. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 485 of 1080 rej09b0230-0300 operation when error occurs during reset-synchronized pwm mode operation, and operation is restarted in pwm mode 1: figure 10.163 shows an explanatory diagram of the case where an error occurs in reset-synchronized pwm mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu2) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu2) 14 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 not initialized (tioc3b) not initialized (tioc3d) hi-z hi-z hi-z figure 10.163 error occurrence in reset-synchronized pwm mode, recovery in pwm mode 1 1 to 10 are the same as in figure 10.162. 11. set pwm mode 1. (mtu2 positive phase output is low, and negative phase output is high.) 12. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 13. set mtu2 output with the pfc. 14. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 486 of 1080 rej09b0230-0300 operation when error occurs during reset-synchronized pwm mode operation, and operation is restarted in complementary pwm mode: figure 10.164 shows an explanatory diagram of the case where an er ror occurs in reset-synchronized pwm mode and operation is restarted in complementary pwm mode after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu2) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 toer (0) 12 tocr 13 tmdr (cpwm) 14 toer (1) 15 pfc (mtu2) 16 tstr (1) mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 hi-z hi-z hi-z figure 10.164 error occurrence in reset-synchronized pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.162. 11. disable channel 3 and 4 output with toer. 12. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 13. set complementary pwm. (the mtu2 cyclic output pin goes low.) 14. enable channel 3 and 4 output with toer. 15. set mtu2 output with the pfc. 16. operation is restarted by tstr.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 487 of 1080 rej09b0230-0300 operation when error occurs during reset-synchronized pwm mode operation, and operation is restarted in reset-synchronized pwm mode: figure 10.165 shows an explanatory diagram of the case where an error occurs in reset-synchronized pwm mode and operation is restarted in reset-sync hronized pwm mode after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu2) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 pfc (mtu2) 12 tstr (1) 13 match mtu2 module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 hi-z hi-z hi-z figure 10.165 error occurrence in reset-synchronized pwm mode, recovery in reset-syn chronized pwm mode 1 to 10 are the same as in figure 10.162. 11. set mtu2 output with the pfc. 12. operation is restarted by tstr. 13. the reset-synchronized pwm waveform is output on compare-match occurrence.
section 10 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu2s) rev. 3.00 oct. 06, 2008 page 488 of 1080 rej09b0230-0300
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 489 of 1080 rej09b0230-0300 section 11 port output enable (poe) the port output enable (poe) module can be used to place the special pins of the mtu2 and mtu2s (pins multiplexed with tioc3b, tioc3d , tioc4a, tioc4b, tioc 4c, and tioc4d in the mtu2 and tioc3bs, tioc3ds, tioc4as, tioc4bs, tioc4cs, and tioc4ds in the mtu2s) and the pins for channel 0 of the mtu2 (pins multiplexed with tioc0a, tioc0b, tioc0c, and tioc0d) in the high-impedance state, depending on the change on poe0 to poe2 , poe4 to poe6 , and poe8 input pins, the output status of the special pins of the mtu2 and mtu2s, or by register settings. it can also generate interrupt requests at the same time. 11.1 features ? each of the poe0 to poe2 , poe4 to poe6 , and poe8 input pins can be set for falling edge, p /8 16, p /16 16, or p /128 16 low-level sampling. ? special pins of the mtu2 and mtu2s and the pi ns for channel 0 of the mtu2 can be placed in the high-impedance state on the falling edge or low-level sampling of the poe0 to poe2 , poe4 to poe6 , and poe8 pins. ? output levels on the special pins of the mtu2 and mtu2s are compared and if active-level outputs continue on multiple pins simultaneously for one cycle or more for p , the special pins of the mtu2 and mtu2s can be pl aced in the high-impedance state. ? special pins of the mtu2 and mtu2s and the pi ns for channel 0 of the mtu2 can be placed in the high-impedance state by modifying the poe register setting. ? interrupts can be generated by input-level sampling or output-level comparison results. the poe has input level detection circuits, output level comparison circuits, and a high-impedance request/interrupt request generating circuit as shown in figure 11.1. in addition to control by the poe, special pins of the mtu2 and mtu2s can be placed in the high-impedance state when the oscillator stops or in software standby state. for details, refer to appendix a, pin states.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 490 of 1080 rej09b0230-0300 figure 11.1 shows a block diagram of the poe. timer output pin state general input timer output general input hi g h impedance state timer output 1p cycle poe input p pfc settin g value power-on reset by wdt figure 11.1 block diagram of poe 11.2 input/output pins table 11.1 pin configuration name symbol i/o description port output enable input pins 0 to 2 poe0 to poe2 input input request signals to place special pins of mtu2 in the high-impedance state port output enable input pins 4 to 6 poe4 to poe6 input input request signals to place special pins of mtu2s in the high- impedance state port output enable input pin 8 poe8 input inputs a request signal to place pins for channel 0 in mtu2 in the high- impedance state
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 491 of 1080 rej09b0230-0300 table 11.2 shows output-level comparisons with pin combinations. table 11.2 pin combinations pin combination i/o description pe9/tioc3b and pe11/tioc3d pe12/tioc4a and pe14/tioc4c pe13/tioc4b and pe15/tioc4d output the special pins for the mtu2 are placed in the high-impedance state when the pins simultaneously output an active level (low level when the output level select p (olsp) bit of the timer output control register (tocr) in the mtu2 is 0 or high level when the bit is 1) for one or more cycles of the peripheral clock (p ). this active level comparison is done when the mtu2 output function or general output function is selected in the pin function controller. if another function is selected, the output level is not checked. pin combinations for output comparison and high- impedance control can be selected by poe registers. pe16/tioc3bs and pe17/tioc3ds pe18/tioc4as and pe20/tioc4cs pe19/tioc4bs and pe21/tioc4ds output the special pins for the mtu2s are placed in the high-impedance state when the pins simultaneously output an active level (low level when the output level select p (olsp) bit of the timer output control register (tocr) in the mtu2s is 0 or high level when the bit is 1) for one or more cycles of the peripheral clock (p ). this active level comparison is done when the mtu2s output function or general output function is selected in the pin function controller. if another function is selected, the output level is not checked. pin combinations for output comparison and high- impedance control can be selected by poe registers.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 492 of 1080 rej09b0230-0300 11.3 register descriptions the poe has the following registers. for details on register addresses and register states during each processing, refer to section 24, list of registers. table 11.3 register configuration register name abbrevia- tion r/w initial value address access size input level control/status register 1 icsr1 r/w h'0000 h'ffffd000 8, 16, 32 output level control/status register 1 ocsr1 r/w h'0000 h'ffffd002 8, 16 input level control/status register 2 icsr2 r/w h'0000 h'ffffd004 8, 16, 32 output level control/status register 2 ocsr2 r/w h'0000 h'ffffd006 8, 16 input level control/status register 3 icsr3 r/w h'0000 h'ffffd008 8, 16 software port output enable register spoer r/w h'00 h'ffffd00a 8 port output enable control register 1 poecr1 r/w h'00 h'ffffd00b 8 port output enable control register 2 poecr2 r/w h'7700 h'ffffd00c 8, 16
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 493 of 1080 rej09b0230-0300 11.3.1 input level control/status register 1 (icsr1) icsr1 is a 16-bit readable/writa ble register that selects the poe0 to poe2 pin input modes, controls the enable/disable of interrupts, and indicates status. bit: initial value: r/w: -- 151413121110987654321 0 0000000000000000 r r/(w) * 1 r/(w) * 1 r/(w) * 1 rrrr/wrrr/w * 2 r/w * 2 r/w * 2 r/w * 2 r/w * 2 r/w * 2 notes: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. can be modified only once after a power-on reset. 1. 2. - poe2f poe1f poe0f - - - pie1 poe2m[1:0] poe1m[1:0] poe0m[1:0] bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 poe2f 0 r/(w) * 1 poe2 flag this flag indicates that a high impedance request has been input to the poe2 pin. [clearing conditions] ? by writing 0 to poe2f after reading poe2f = 1 (when the falling edge is selected by bits 5 and 4 in icsr1) ? by writing 0 to poe2f after reading poe2f = 1 after a high level input to poe2 is sampled at p /8, p /16, or p /128 clock (when low-level sampling is selected by bits 5 and 4 in icsr1) [setting condition] ? when the input set by icsr1 bits 5 and 4 occurs at the poe2 pin
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 494 of 1080 rej09b0230-0300 bit bit name initial value r/w description 13 poe1f 0 r/(w) * 1 poe1 flag this flag indicates that a high impedance request has been input to the poe1 pin. [clearing conditions] ? by writing 0 to poe1f after reading poe1f = 1 (when the falling edge is selected by bits 3 and 2 in icsr1) ? by writing 0 to poe1f after reading poe1f = 1 after a high level input to poe1 is sampled at p /8, p /16, or p /128 clock (when low-level sampling is selected by bits 3 and 2 in icsr1) [setting condition] ? when the input set by icsr1 bits 3 and 2 occurs at the poe1 pin 12 poe0f 0 r/(w) * 1 poe0 flag this flag indicates that a high impedance request has been input to the poe0 pin. [clearing conditions] ? by writing 0 to poe0f after reading poe0f = 1 (when the falling edge is selected by bits 1 and 0 in icsr1) ? by writing 0 to poe0f after reading poe0f = 1 after a high level input to poe0 is sampled at p /8, p /16, or p /128 clock (when low-level sampling is selected by bits 1 and 0 in icsr1) [setting condition] ? when the input set by icsr1 bits 1 and 0 occurs at the poe0 pin 11 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 495 of 1080 rej09b0230-0300 bit bit name initial value r/w description 8 pie1 0 r/w port interrupt enable 1 this bit enables/disables interrupt requests when any one of the poe0f to poe2f bits of the icsr1 is set to 1. 0: interrupt requests disabled 1: interrupt requests enabled 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5, 4 poe2m[1:0] 00 r/w * 2 poe2 mode 1, 0 these bits select the input mode of the poe2 pin. 00: accept request on falling edge of poe2 input 01: accept request when poe2 input has been sampled for 16 p /8 clock pulses and all are low level. 10: accept request when poe2 input has been sampled for 16 p /16 clock pulses and all are low level. 11: accept request when poe2 input has been sampled for 16 p /128 clock pulses and all are low level. 3, 2 poe1m[1:0] 00 r/w * 2 poe1 mode 1, 0 these bits select the input mode of the poe1 pin. 00: accept request on falling edge of poe1 input 01: accept request when poe1 input has been sampled for 16 p /8 clock pulses and all are low level. 10: accept request when poe1 input has been sampled for 16 p /16 clock pulses and all are low level. 11: accept request when poe1 input has been sampled for 16 p /128 clock pulses and all are low level.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 496 of 1080 rej09b0230-0300 bit bit name initial value r/w description 1, 0 poe0m[1:0] 00 r/w * 2 poe0 mode 1, 0 these bits select the input mode of the poe0 pin. 00: accept request on falling edge of poe0 input 01: accept request when poe0 input has been sampled for 16 p /8 clock pulses and all are low level. 10: accept request when poe0 input has been sampled for 16 p /16 clock pulses and all are low level. 11: accept request when poe0 input has been sampled for 16 p /128 clock pulses and all are low level. notes: 1. writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 2. can be modified only once after a power-on reset. 11.3.2 output level control/status register 1 (ocsr1) ocsr1 is a 16-bit readable/writable register that controls the enable/disable of both output level comparison and interrupts, and indicates status. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrr r/wrrrrrrrr r/(w) * 1 r/w * 2 osf1 - - - - - oce1 oie1 - - - - - - - - notes: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. can be modified only once after a power-on reset. 1. 2. bit bit name initial value r/w description 15 osf1 0 r/(w) * 1 output short flag 1 this flag indicates that any one of the three pairs of mtu2 2-phase outputs to be compared has simultaneously become an active level. [clearing condition] ? by writing 0 to osf1 after reading osf1 = 1 [setting condition] ? when any one of the three pairs of 2-phase outputs has simultaneously become an active level
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 497 of 1080 rej09b0230-0300 bit bit name initial value r/w description 14 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 oce1 0 r/w * 2 output short high-impedance enable 1 this bit specifies whether to place the pins in the high- impedance state when the osf1 bit in ocsr1 is set to 1. 0: does not place the pins in the high-impedance state 1: places the pins in the high-impedance state 8 oie1 0 r/w output short interrupt enable 1 this bit enables or disables interrupt requests when the osf1 bit in ocsr is set to 1. 0: interrupt requests disabled 1: interrupt requests enabled 7 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. notes: 1. writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 2. can be modified only once after a power-on reset.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 498 of 1080 rej09b0230-0300 11.3.3 input level control/status register 2 (icsr2) icsr2 is a 16-bit readable/writa ble register that selects the poe4 to poe6 pin input modes, controls the enable/disable of interrupts, and indicates status. bit: initial value: r/w: -- 151413121110987654321 0 0000000000000000 r r/(w) * 1 r/(w) * 1 r/(w) * 1 rrrr/wrrr/w * 2 r/w * 2 r/w * 2 r/w * 2 r/w * 2 r/w * 2 notes: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. can be modified only once after a power-on reset. 1. 2. - poe6f poe5f poe4f - - - pie2 poe6m[1:0] poe5m[1:0] poe4m[1:0] bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 poe6f 0 r/(w) * 1 poe6 flag this flag indicates that a high impedance request has been input to the poe6 pin. [clearing conditions] ? by writing 0 to poe6f after reading poe6f = 1 (when the falling edge is selected by bits 5 and 4 in icsr2) ? by writing 0 to poe6f after reading poe6f = 1 after a high level input to poe6 is sampled at p /8, p /16, or p /128 clock (when low-level sampling is selected by bits 5 and 4 in icsr2) [setting condition] ? when the input condition set by bits 5 and 4 in icsr2 occurs at the poe6 pin
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 499 of 1080 rej09b0230-0300 bit bit name initial value r/w description 13 poe5f 0 r/(w) * 1 poe5 flag this flag indicates that a high impedance request has been input to the poe5 pin. [clearing conditions] ? by writing 0 to poe5f after reading poe5f = 1 (when the falling edge is selected by bits 3 and 2 in icsr2) ? by writing 0 to poe5f after reading poe5f = 1 after a high level input to poe5 is sampled at p /8, p /16, or p /128 clock (when low-level sampling is selected by bits 3 and 2 in icsr2) [setting condition] ? when the input condition set by bits 3 and 2 in icsr2 occurs at the poe5 pin 12 poe4f 0 r/(w) * 1 poe4 flag this flag indicates that a high impedance request has been input to the poe4 pin. [clearing conditions] ? by writing 0 to poe4f after reading poe4f = 1 (when the falling edge is selected by bits 1 and 0 in icsr2) ? by writing 0 to poe4f after reading poe4f = 1 after a high level input to poe4 is sampled at p /8, p /16, or p /128 clock (when low-level sampling is selected by bits 1 and 0 in icsr2) [setting condition] ? when the input condition set by bits 1 and 0 in icsr2 occurs at the poe4 pin 11 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 500 of 1080 rej09b0230-0300 bit bit name initial value r/w description 8 pie2 0 r/w port interrupt enable 2 this bit enables/disables interrupt requests when any one of the poe4f to poe7f bits of the icsr2 is set to 1. 0: interrupt requests disabled 1: interrupt requests enabled 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5, 4 poe6m[1:0] 00 r/w * 2 poe6 mode 1 and 0 these bits select the input mode of the poe6 pin. 00: accept request on falling edge of poe6 input 01: accept request when poe6 input has been sampled for 16 p /8 clock pulses and all are at a low level. 10: accept request when poe6 input has been sampled for 16 p /16 clock pulses and all are at a low level. 11: accept request when poe6 input has been sampled for 16 p /128 clock pulses and all are at a low level. 3, 2 poe5m[1:0] 00 r/w * 2 poe5 mode 1 and 0 these bits select the input mode of the poe5 pin. 00: accept request on falling edge of poe5 input 01: accept request when poe5 input has been sampled for 16 p /8 clock pulses and all are at a low level. 10: accept request when poe5 input has been sampled for 16 p /16 clock pulses and all are at a low level. 11: accept request when poe5 input has been sampled for 16 p /128 clock pulses and all are at a low level.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 501 of 1080 rej09b0230-0300 bit bit name initial value r/w description 1, 0 poe4m[1:0] 00 r/w * 2 poe4 mode 1 and 0 these bits select the input mode of the poe4 pin. 00: accept request on falling edge of poe4 input 01: accept request when poe4 input has been sampled for 16 p /8 clock pulses and all are at a low level. 10: accept request when poe4 input has been sampled for 16 p /16 clock pulses and all are at a low level. 11: accept request when poe4 input has been sampled for 16 p /128 clock pulses and all are at a low level. notes: 1. writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 2. can be modified only once after a power-on reset. 11.3.4 output level control/status register 2 (ocsr2) ocsr2 is a 16-bit readable/writable register that controls the enable/disable of both output level comparison and interrupts, and indicates status. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/(w) * 1 rrrrrr/w * 2 r/wrrrrrrrr notes: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. can be modified only once after a power-on reset. 1. 2. osf2 - - - - - oce2 oie2 - - - - - - - - bit bit name initial value r/w description 15 osf2 0 r/(w) * 1 output short flag 2 this flag indicates that any one of the three pairs of mtu2s 2-phase outputs to be compared has simultaneously become an active level. [clearing condition] ? by writing 0 to osf2 after reading osf2 = 1 [setting condition] ? when any one of the three pairs of 2-phase outputs has simultaneously become an active level
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 502 of 1080 rej09b0230-0300 bit bit name initial value r/w description 14 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 oce2 0 r/w * 2 output short high-impedance enable 2 this bit specifies whether to place the pins in the high- impedance state when the osf2 bit in ocsr2 is set to 1. 0: does not place the pins in the high-impedance state 1: places the pins in the high-impedance state 8 oie2 0 r/w output short interrupt enable 2 this bit enables or disables interrupt requests when the osf2 bit in ocsr2 is set to 1. 0: interrupt requests disabled 1: interrupt requests enabled 7 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. notes: 1. writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 2. can be modified only once after a power-on reset.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 503 of 1080 rej09b0230-0300 11.3.5 input level control/status register 3 (icsr3) icsr3 is a 16-bit readable/writa ble register that selects the poe8 pin input mode, controls the enable/disable of interrupts, and indicates status. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrr r/(w) * 1 rrr/w * 2 r/wrrrrrrr/w * 2 r/w * 2 notes: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. can be modified only once after a power-on reset. 1. 2. poe8f - - poe8e - - - - - - - - pie3 - poe8m[1:0] bit bit name initial value r/w description 15 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 12 poe8f 0 r/(w) * 1 poe8 flag this flag indicates that a high impedance request has been input to the poe8 pin. [clearing conditions] ? by writing 0 to poe8f after reading poe8f = 1 (when the falling edge is selected by bits 1 and 0 in icsr3) ? by writing 0 to poe8f after reading poe8f = 1 after a high level input to poe8 is sampled at p /8, p / 16, or p /128 clock (when low-level sampling is selected by bits 1 and 0 in icsr3) [setting condition] ? when the input condition set by bits 1 and 0 in icsr3 occurs at the poe8 pin 11, 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 504 of 1080 rej09b0230-0300 bit bit name initial value r/w description 9 poe8e 0 r/w * 2 poe8 high-impedance enable this bit specifies whether to place the pins in the high- impedance state when the poe8f bit in icsr3 is set to 1. 0: does not place the pins in the high-impedance state 1: places the pins in the high-impedance state 8 pie3 0 r/w port interrupt enable 3 this bit enables or disables interrupt requests when the poe8 bit in icsr3 is set to 1. 0: interrupt requests disabled 1: interrupt requests enabled 7 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1, 0 poe8m[1:0] 00 r/w * 2 poe8 mode 1 and 0 these bits select the input mode of the poe8 pin. 00: accept request on falling edge of poe8 input 01: accept request when poe8 input has been sampled for 16 p /8 clock pulses and all are low level. 10: accept request when poe8 input has been sampled for 16 p /16 clock pulses and all are low level. 11: accept request when poe8 input has been sampled for 16 p /128 clock pulses and all are low level. notes: 1. writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 2. can be modified only once after a power-on reset.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 505 of 1080 rej09b0230-0300 11.3.6 software port output enable register (spoer) spoer is an 8-bit readable/writable register that controls high-impedance state of the pins. bit: initial value: r/w: 7654321 0 00000000 r r r r r r/w r/w r/w ----- mtu2s hiz mtu2 ch0hiz mtu2 ch34hiz bit bit name initial value r/w description 7 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 mtu2shiz 0 r/w mtu2s output high-impedance this bit specifies whether to place the special pins for the mtu2s in the high-impedance state. 0: does not place the pins in the high-impedance state [clearing conditions] ? power-on reset ? by writing 0 to mtu2shiz after reading mtu2shiz = 1 1: places the pins in the high-impedance state [setting condition] ? by writing 1 to mtu2shiz 1 mtu2ch0hiz 0 r/w mtu2 channel 0 output high-impedance this bit specifies whether to place the pins for channel 0 in the mtu2 in the high-impedance state. 0: does not place the pins in the high-impedance state [clearing conditions] ? power-on reset ? by writing 0 to mtu2ch0hiz after reading mtu2ch0hiz = 1 1: places the pins in the high-impedance state [setting condition] ? by writing 1 to mtu2ch0hiz
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 506 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 mtu2ch34hiz 0 r/w mtu2 channel 3 and 4 output high-impedance this bit specifies whether to place the special pins for the mtu2 in the high-impedance state. 0: does not place the pins in the high-impedance state [clearing conditions] ? power-on reset ? by writing 0 to mtu2ch34hiz after reading mtu2ch34hiz = 1 1: places the pins in the high-impedance state [setting condition] ? by writing 1 to mtu2ch34hiz 11.3.7 port output enable co ntrol register 1 (poecr1) poecr1 is an 8-bit readable/writable register that controls high-impedance state of the pins. bit: initial value: r/w: 7654321 0 00000000 rrrrr/w * r/w * r/w * r/w * note: can be modified only once after a power-on reset. * ---- mtu2 pe3ze mtu2 pe2ze mtu2 pe1ze mtu2 pe0ze bit bit name initial value r/w description 7 to 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 mtu2pe3ze 0 r/w * mtu2 pe3 high-impedance enable this bit specifies whether to place the pe3/tioc0d pin for channel 0 in the mtu2 in the high-impedance state when either poe8f or mtu2ch0hiz bit is set to 1. 0: does not place the pin in the high-impedance state 1: places the pin in the high-impedance state
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 507 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 mtu2pe2ze 0 r/w * mtu2 pe2 high-impedance enable this bit specifies whether to place the pe2/tioc0c pin for channel 0 in the mtu2 in the high-impedance state when either poe8f or mtu2ch0hiz bit is set to 1. 0: does not place the pin in the high-impedance state 1: places the pin in the high-impedance state 1 mtu2pe1ze 0 r/w * mtu2 pe1 high-impedance enable this bit specifies whether to place the pe1/tioc0b pin for channel 0 in the mtu2 in the high-impedance state when either poe8f or mtu2ch0hiz bit is set to 1. 0: does not place the pin in the high-impedance state 1: places the pin in the high-impedance state 0 mtu2pe0ze 0 r/w * mtu2 pe0 high-impedance enable this bit specifies whether to place the pe0/tioc0a pin for channel 0 in the mtu2 in the high-impedance state when either poe8f or mtu2ch0hiz bit is set to 1. 0: does not place the pin in the high-impedance state 1: places the pin in the high-impedance state note: * can be modified only once after a power-on reset.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 508 of 1080 rej09b0230-0300 11.3.8 port output enable co ntrol register 2 (poecr2) poecr2 is a 16-bit readable/writable register that controls high-impedance state of the pins. bit: initial value: r/w: 151413121110987654321 0 0111011100000000 rr/w * r/w * r/w * rr/w * r/w * r/w * rrrrrrrr note: can be modified only once after a power-on reset. * - mtu2 p1cze mtu2 p2cze mtu2 p3cze - mtu2s p1cze mtu2s p2cze mtu2s p3cze -------- bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 mtu2p1cze 1 r/w * mtu2 port 1 output comparison/high-impedance enable this bit specifies whether to compare output levels on the mtu2 special pins, pe9/tioc3b and pe11/tioc3d, and to place them in the high- impedance state when the osf1 bit is set to 1 while the oce1 bit is 1 or when any one of the poe0f, poe1f, poe2f, and mtu2ch34hiz bits is set to 1. 0: does not compare output levels or place the pins in the high-impedance state 1: compares output levels and places the pins in the high-impedance state 13 mtu2p2cze 1 r/w * mtu2 port 2 output comparison/high-impedance enable this bit specifies whether to compare output levels on the mtu2 special pins, pe12/tioc4a and pe14/tioc4c, and to place them in the high- impedance state when the osf1 bit is set to 1 while the oce1 bit is 1 or when any one of the poe0f, poe1f, poe2f, and mtu2ch34hiz bits is set to 1. 0: does not compare output levels or place the pins in the high-impedance state 1: compares output levels and places the pins in the high-impedance state
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 509 of 1080 rej09b0230-0300 bit bit name initial value r/w description 12 mtu2p3cze 1 r/w * mtu2 port 3 output comparison/high-impedance enable this bit specifies whether to compare output levels on the mtu2 special pins, pe13/tioc4b and pe15/tioc4d, and to place them in the high- impedance state when the osf1 bit is set to 1 while the oce1 bit is 1 or when any one of the poe0f, poe1f, poe2f, and mtu2ch34hiz bits is set to 1. 0: does not compare output levels or place the pins in the high-impedance state 1: compares output levels and places the pins in the high-impedance state 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 mtu2sp1cze 1 r/w * mtu2s port 1 output comparison/high-impedance enable this bit specifies whether to compare output levels on the mtu2 special pins, pe16/tioc3bs and pe17/tioc3ds, and to place them in the high- impedance state when the osf2 bit is set to 1 while the oce2 bit is 1 or when any one of the poe4f, poe5f, poe6f, poe7f, a nd mtu2shiz bits is set to 1. 0: does not compare output levels or place the pins in the high-impedance state 1: compares output levels and places the pins in the high-impedance state
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 510 of 1080 rej09b0230-0300 bit bit name initial value r/w description 9 mtu2sp2cze 1 r/w * mtu2s port 2 output comparison/high-impedance enable this bit specifies whether to compare output levels on the mtu2 special pins, pe18/tioc4as and pe20/tioc4cs, and to place them in the high- impedance state when the osf2 bit is set to 1 while the oce2 bit is 1 or when any one of the poe4f, poe5f, poe6f, poe7f, a nd mtu2shiz bits is set to 1. 0: does not compare output levels or place the pins in the high-impedance state 1: compares output levels and places the pins in the high-impedance state 8 mtu2sp3cze 1 r/w * mtu2s port 3 output comparison/high-impedance enable this bit specifies whether to compare output levels on the mtu2 special pins, pe19/tioc4bs and pe21/tioc4ds, and to place them in the high- impedance state when the osf2 bit is set to 1 while the oce2 bit is 1 or when any one of the poe4f, poe5f, poe6f, poe7f, a nd mtu2shiz bits is set to 1. 0: does not compare output levels or place the pins in the high-impedance state 1: compares output levels and places the pins in the high-impedance state 7 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. note: * can be modified only once after a power-on reset.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 511 of 1080 rej09b0230-0300 11.4 operation table 11.4 shows the target pins for high-impedance control and cond itions to place the pins in the high-impedance state. table 11.4 target pins and condi tions for high-i mpedance control pins conditions detailed conditions mtu2 special pins (pe9/tioc3b and pe11/tioc3d) input level detection, output level comparison, or spoer setting mtu2p1cze ? ((poe2f + poe1f + poe0f) + (osf1 ? oce1) + (mtu2ch34hiz)) mtu2 special pins (pe12/tioc4a and pe14/tioc4c) input level detection, output level comparison, or spoer setting mtu2p2cze ? ((poe2f + poe1f + poe0f) + (osf1 ? oce1) + (mtu2ch34hiz)) mtu2 special pins (pe13/tioc4b and pe15/tioc4d) input level detection, output level comparison, or spoer setting mtu2p3cze ? ((poe2f + poe1f + poe0f) + (osf1 ? oce1) + (mtu2ch34hiz)) mtu2s special pins (pe16/tioc3bs and pe17/tioc3ds) input level detection, output level comparison, or spoer setting mtu2sp1cze ? ((poe4f + poe5f + poe6f) + (osf2 ? oce2) + (mtu2shiz)) mtu2s special pins (pe18/tioc4as and pe20/tioc4cs) input level detection, output level comparison, or spoer setting mtu2sp2cze ? ((poe4f + poe5f + poe6f) + (osf2 ? oce2) + (mtu2shiz)) mtu2s special pins (pe19/tioc4bs and pe21/tioc4ds) input level detection, output level comparison, or spoer setting mtu2sp3cze ? ((poe4f + poe5f + poe6f) + (osf2 ? oce2) + (mtu2shiz)) mtu2 channel 0 pin (pe0/tioc0a) input level detection or spoer setting mtu2pe0ze ((poe8f ? poe8e) + (mtu2ch0hiz)) mtu2 channel 0 pin (pe1/tioc0b) input level detection or spoer setting mtu2pe1ze ((poe8f ? poe8e) + (mtu2ch0hiz)) mtu2 channel 0 pin (pe2/tioc0c) input level detection or spoer setting mtu2pe2ze ((poe8f ? poe8e) + (mtu2ch0hiz)) mtu2 channel 0 pin (pe3/tioc0d) input level detection or spoer setting mtu2pe3ze ((poe8f ? poe8e) + (mtu2ch0hiz))
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 512 of 1080 rej09b0230-0300 11.4.1 input level detection operation if the input conditions set by icsr1 to icsr3 occur on the poe0 to poe2 , poe4 to poe6 , and poe8 pins, the special pins of the mtu2 and mtu2 s and the pins for channel 0 of the mtu2 are placed in the high-impedance state. note however, that these special pins and mtu2 pins enter high-impedance state only when general input/o utput function, mtu2 function, or mtu2s function is selected for these pins. (1) falling edge detection when a change from a high to low level is input to the poe0 to poe2 , poe4 to poe6 , and poe8 pins, the special pins of the mtu2 and mtu2s a nd the pins for channel 0 of the mtu2 are placed in the high-impedance state. figure 11.2 shows a sample timing after the level changes in input to the poe0 to poe2 , poe4 to poe6 , and poe8 pins until the respective pins enter high-impedance state. p poe input pe9/tioc3b p risin g ed g e fallin g ed g e detection hi g h-impedance state * note: * other special pins of mtu2 and mtu2s also enter the hi g h-impedance state with the same timin g . figure 11.2 falling edge detection
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 513 of 1080 rej09b0230-0300 (2) low-level detection figure 11.3 shows the low-level detection operation. sixteen continuous low levels are sampled with the sampling clock selected by icsr1 to icsr3. if even one high level is detected during this interval, the low leve l is not accepted. the timing when the special pins of the mtu2 and mtu2s enter the high-impedance state after the sampling clock is input is the same in both fa lling-edge detection and in low-level detection. p samplin g clock 3 poe input pe9/ tioc3b when low level is sampled at all points when hi g h level is sampled at least once fla g set ( poe received) fla g not set hi g h-impedance state * note: * other special pins of mtu2 and mtu2s also enter the hi g h-impedance state with the same timin g . 2 1 2 1 16 13 8/16/128 clock cycles figure 11.3 low-level detection operation 11.4.2 output-level co mpare operation figure 11.4 shows an example of the output-level compare operation for the combination of tioc3b and tioc3d. the operation is the same for the other pin combinations. p pe11/ tioc3d pe9/ tioc3b low level overlappin g detected hi g h impedance state figure 11.4 output-lev el compare operation
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 514 of 1080 rej09b0230-0300 11.4.3 release from high-impedance state the special pins of the mtu2 and mtu2s that have entered high-impedance state due to input- level detection can be released either by returning them to their initial state with a power-on reset, or by clearing all of the flags in bits 12 to 15 (poe0f to poe2f, poe4f to poe6f, and poe8f) of icsr1 to icsr3. however, note that when low-level sampling is selected by bits 0 to 7 in icsr1 to icsr3, just writing 0 to a flag is ignored (the flag is not cleared); flags can be cleared by writing 0 to it only after a high level is input to the poe pin and is sampled. the special pins of the mtu2 and mtu2s that have entered high-impedance state due to output- level detection can be released either by returning them to their initial state with a power-on reset, or by clearing the flag in bit 15 (ocf1 and ocf2) in ocsr1 and ocsr2. however, note that just writing 0 to a flag is ignored (the flag is not cl eared); flags can be cleared only after an inactive level is output from the special pins of the mtu2 and mtu2s. inactive-level outputs can be obtained by setting the mtu2 and mtu2s internal registers.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 515 of 1080 rej09b0230-0300 11.5 interrupts the poe issues a request to generate an interrupt when the specified condition is satisfied during input level detection or output level comparison. table 11.5 shows the interrupt sources and their conditions. table 11.5 interrupt sources and conditions name interrupt source interrupt flag condition oei1 output enable interrupt 1 poe2f, poe1f, poe0f, and osf1 pie1 ? (poe2f + poe1f + poe0f) + oie1 ? osf1 oei3 output enable interrupt 3 poe8f pie3 ? poe8f oei2 output enable interrupt 2 poe4f, poe5f, poe6f, and osf2 pie2 ? (poe4f + poe5f + poe6f) + oie2 ? osf2 11.6 usage note 11.6.1 pin state when a power-on reset is issued from the watchdog timer when a power-on reset is issued from the watchdog timer (wdt), initialization of the pin function controller (pfc) sets initial values that select the general input function for the i/o ports. however, when a power-on reset is issued from the wdt while a pin is being handled as high impedance by the port output enable (poe), the pin is placed in the output state for one cycle of the peripheral clock (pf), after which the function is switched to general input. this also occurs when a power-on reset is issued from the wdt for pins that are being handled as high impedance due to short-circuit detection by the mtu2 and mtu2s. figure 11.5 shows the state of a pin for which the poe input has selected high impedance handling with the timer output selected when a power-on reset is issued from the wdt.
section 11 port output enable (poe) rev. 3.00 oct. 06, 2008 page 516 of 1080 rej09b0230-0300 timer output pin state general input timer output general input hi g h impedance state timer output 1p cycle poe input p pfc settin g value power-on reset by wdt figure 11.5 pin state when a power-on reset is issued from the watchdog timer
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 517 of 1080 rej09b0230-0300 section 12 watchdog timer (wdt) this lsi includes the watchdog timer (wdt). this lsi can be reset by the overflow of the counter when the value of the counter has not been updated because of a system runaway. the watchdog timer (wdt) is a single-channel timer that uses a peripheral clock as an input and counts the clock settling time when re voking software standby mode. it can also be used as an interval timer. 12.1 features ? can be used to ensure the clock settling time: use the wdt to revoke software standby mode. ? can switch between watchdog timer mode and interval timer mode. ? generates internal resets in watchdog timer mode: internal resets occur after counter overflow. ? an interrupt is generated in interval timer mode an interval timer interrupt is generated when the counter overflows. ? choice of eight counter input clocks eight clocks ( 1 to 1/4096) that are obtained by dividing the peripheral clock can be chosen. ? choice of two resets power-on reset and manual reset are available. figure 12.1 shows a block diagram of the wdt.
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 518 of 1080 rej09b0230-0300 wtcsr standby control bus interface wtcnt divider clock selector internal bus clock standby mode peripheral clock (p ) standby cancellation reset control clock selection wdt overflow wdtovf internal reset request interrupt control interrupt request [le g end] wtcsr: wtcnt: watchdo g timer control/status re g ister watchdo g timer counter figure 12.1 block diagram of wdt
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 519 of 1080 rej09b0230-0300 12.2 input/output pin for wdt table 12.1 lists the wdt pin configuration. table 12.1 wdt pin configuration pin name abbreviation i/o description watchdog timer overflow wdtovf output when an overflow occurs in watchdog timer mode, an internal reset is generated and this pin outputs the low level for one clock cycle specified by the cks2 to cks0 bits in wtcsr.
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 520 of 1080 rej09b0230-0300 12.3 register descriptions the wdt has the following two registers. refer to section 24, list of registers, for the details of the addresses of these registers and the state of registers in each operating mode. table 12.2 register configuration register name abbrevia- tion r/w initial value address access size watchdog timer counter wtcnt r/w h'00 h'ffffe810 8, 16 watchdog timer control/status register wtcsr r/w h'00 h'ffffe812 8, 16 12.3.1 watchdog timer counter (wtcnt) wtcnt is an 8-bit readable/writable register th at increments on the selected clock. when an overflow occurs, it generates a reset in watchdog timer mode and an interrupt in interval time mode. the wtcnt counter is not initialized by an internal reset due to the wdt overflow. the wtcnt counter is initialized to h'00 only by a power-on reset using the res pin. use a word access to write to the wtcnt counter, with h'5a in the upper byte. use a byte access to read wtcnt. note: wtcnt differs from other registers in that it is more difficult to write to. see section 12.3.3, notes on register access, for details. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 521 of 1080 rej09b0230-0300 12.3.2 watchdog timer control/s tatus register (wtcsr) wtcsr is an 8-bit readable/writabl e register composed of bits to select the clock used for the count, bits to select the timer mode, and overflow flags. wtcsr holds its value in an internal reset due to the wdt overflow. wtcsr is initialized to h'00 only by a power-on reset using the res pin. when used to count the clock settling time for re voking a software standby, it retains its value after counter overflow. use a word access to write to wtcsr, with h'a5 in the upper byte. use a byte access to read wtcsr. note: wtcsr differs from other registers in that it is more difficult to write to. see section 12.3.3, notes on register access, for details. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w tme wt/it rsts wovf iovf cks[2:0] bit bit name initial value r/w description 7 tme 0 r/w timer enable starts and stops timer operation. clear this bit to 0 when using the wdt to revoke software standby mode. 0: timer disabled: count-up stops and wtcnt value is retained 1: timer enabled 6 wt/it 0 r/w timer mode select selects whether to use the wdt as a watchdog timer or an interval timer. 0: interval timer mode 1: watchdog timer mode note: if wt/it is modified when the wdt is operating, the up-count may not be performed correctly.
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 522 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 rsts 0 r/w reset select selects the type of reset when the wtcnt overflows in watchdog timer mode. in interval timer mode, this setting is ignored. 0: power-on reset 1: manual reset 4 wovf 0 r/w watchdog timer overflow indicates that the wtcnt has overflowed in watchdog timer mode. this bit is not set in interval timer mode. 0: no overflow 1: wtcnt has overflowed in watchdog timer mode 3 iovf 0 r/w interval timer overflow indicates that the wtcnt has overflowed in interval timer mode. this bit is not set in watchdog timer mode. 0: no overflow 1: wtcnt has overflowed in interval timer mode 2 to 0 cks[2:0] 000 r/w clock select 2 to 0 these bits select the clock to be used for the wtcnt count from the eight types obtainable by dividing the peripheral clock (p ). the overflow period that is shown inside the parenthesis in the table is the value when the peripheral clock (p ) is 40 mhz. 000: p (6.4 s) 001: p /4 (25.6 s) 010: p /16 (102.4 s) 011: p /32 (204.8 s) 100: p /64 (409.6 s) 101: p /256 (1.64 ms) 110: p /1024 (6.55 ms) 111: p /4096 (26.21 ms) note: if bits cks2 to cks0 are modified when the wdt is operating, the up-count may not be performed correctly. ensure that these bits are modified only when the wdt is not operating.
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 523 of 1080 rej09b0230-0300 12.3.3 notes on register access the watchdog timer counter (wtcnt) and watchdog timer control/status register (wtcsr) are more difficult to write to than other registers. the procedure for writing to these registers is given below. writing to wtcnt and wtcsr: these registers must be written by a word transfer instruction. they cannot be written by a byte or longword transfer instruction. when writing to wtcnt, set the upper byte to h'5a and transfer the lower byte as the write data, as shown in figure 12.2. when writing to wtcsr, set the upper byte to h'a5 and transfer the lower byte as the write data. this transfer procedure writes the lower byte data to wtcnt or wtcsr. 15 8 7 0 h'5a write data address: h'ffffe810 wtcnt write 15 8 7 0 h'a5 write data address: h'ffffe812 wtcsr write figure 12.2 writing to wtcnt and wtcsr
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 524 of 1080 rej09b0230-0300 12.4 operation 12.4.1 revoking software standbys the wdt can be used to revoke software standby mode with an nmi interrupt or external interrupt (irq). the procedure is described below. (the wdt does not run when resets are used for revoking, so keep the res pin low until the clock stabilizes.) 1. before transition to software standby mode, always clear the tme bit in wtcsr to 0. when the tme bit is 1, an erroneous reset or interval timer interrupt may be generated when the count overflows. 2. set the type of count clock used in the cks2 to cks0 bits in wtcsr and the initial values for the counter in the wtcnt counter. these va lues should ensure that the time till count overflow is longer than the clock oscillation settling time. 3. transition to software standby mode by ex ecuting a sleep instruction to stop the clock. 4. the wdt starts counting by detecting a change in the level input to the nmi or irq pin. 5. when the wdt count overflows, the cpg starts supplying the clock and the lsi resumes operation. the wovf flag in wtcsr is not set when this happens. 12.4.2 using watchdog timer mode while operating in watchdog timer mode, the wdt generates an internal reset of the type specified by the rsts bit in wtcsr and asserts a signal through the wdtovf pin every time the counter overflows. 1. set the wt/it bit in wtcsr to 1, set the reset type in the rsts bit, set the type of count clock in the cks2 to cks0 bits, and set th e initial value of the counter in the wtcnt counter. 2. set the tme bit in wtcsr to 1 to start the count in watchdog timer mode. 3. while operating in watchdog timer mode, rewrite the counter periodically to h'00 to prevent the counter from overflowing. 4. when the counter overflows, the wdt sets the wovf flag in wtcsr to 1, asserts a signal through the wdtovf pin for one cycle of the count clock specified by the cks2 to cks0 bits, and generates a reset of the type specified by the rsts bit. the counter then resumes counting.
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 525 of 1080 rej09b0230-0300 wtcnt value h'ff h'00 wdtovf si g nal internal reset si g nal (power-on reset selected) overflow occurs h'00 is written to wtcnt wt/it = 1 tme = 1 h'00 is written to wtcnt count starts wovf = 1 wdtovf is asserted and an internal reset is g enerated 32 p clock 3 p + one cycle of count clock internal reset si g nal (manual reset selected) 18 p clock time figure 12.3 operation in watchdog timer mode (when wtcnt count clock is specified to p /32 by cks2 to cks0) 12.4.3 using interval timer mode when operating in interval timer mode, interval timer interrupts are generated at every overflow of the counter. this enables interrupts to be generated at set periods. 1. clear the wt/it bit in wtcsr to 0, set the type of count clock in the cks2 to cks0 bits, and set the initial value of the co unter in the wtcnt counter. 2. set the tme bit in wtcsr to 1 to start the count in interval timer mode. 3. when the counter overflows, the wdt sets the iovf flag in wtcsr to 1 and an interval timer interrupt request is sent to the intc. the counter then resumes counting.
section 12 watchdog timer (wdt) rev. 3.00 oct. 06, 2008 page 526 of 1080 rej09b0230-0300 12.5 usage note 12.5.1 wtcnt setting value if wtcnt is set to h'ff in interval timer mode, overflow does not occur when wtcnt changes from h'ff to h'00 after one cycle of count clock, but overflow occurs when wtcnt changes from h'ff to h'00 after 257 cycles of count clock. if wtcnt is set to h'ff in watchdog timer mode, overflow occurs when wtcnt changes from h'ff to h'00 after one cycle of count clock.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 527 of 1080 rej09b0230-0300 section 13 serial communication interface (sci) this lsi has three independent serial communication interface (sci) channels. the sci can handle both asynchronous and clock synchronous serial communication. in asynchronous serial communication mode, serial data communication can be carried out with standard asynchronous communication chips such as a universal asynchronous receiver/transmitter (uart) or asynchronous communication interface adapter (acia). a function is also provided for serial communication between processors (multiprocessor communication function). 13.1 features ? choice of asynchronous or clock synchronous serial communication mode ? asynchronous mode: ? serial data communication is performed by start-stop in character units. the scif can communicate with a universal asynchronous r eceiver/transmitter (uart), an asynchronous communication interface adapter (acia), or an y other communications chip that employs a standard asynchronous serial system. th ere are twelve selectable serial data communication formats. ? data length: 7 or 8 bits ? stop bit length: 1 or 2 bits ? parity: even, odd, or none ? multiprocessor communications ? receive error detection: parity , overrun, and framing errors ? break detection: break is detected by reading the rxd pin level directly when a framing error occurs. ? clock synchronous mode: ? serial data communication is synchronized w ith a clock signal. the scif can communicate with other chips having a clock synchronous communication function. ? data length: 8 bits ? receive error detection: overrun errors ? full duplex communication: the transmitting and r eceiving sections are independent, so the sci can transmit and receive simultaneously. bo th sections use double buffering, so high- speed continuous data transfer is possible in both the transmit and receive directions. ? on-chip baud rate generator with selectable bit rates ? internal or external transmit/receive clock source: from either baud rate generator (internal clock) or sck pin (external clock) ? choice of lsb-first or msb-first data transfer (except for 7-bit data in asynchronous mode)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 528 of 1080 rej09b0230-0300 ? four types of interrupts: there are four interrupt sources, transmit-data-empty, transmit end, receive-data-full, and receive error interr upts, and each interrupt can be requested independently. the data transfer controller (dtc) can be activated by the transmit-data-empty interrupt or receive-data-full interrupt to transfer data. ? module standby mode can be set figure 13.1 shows a block diagram of the sci. receive shift re g ister receive data re g ister transmit shift re g ister transmit data re g ister serial mode re g ister serial control re g ister serial status re g ister bit rate re g ister serial port re g ister serial direction control re g ister internal data bus p scrdr module data bus sctdr scrsr sctsr scssr scsmr scsptr scscr scsdcr scbrr transmission/reception control baud rate g enerator clock tei txi rxi eri external clock parity g eneration parity check p /4 p /16 p /64 sck txd rxd sci [le g end] scrsr: scrdr: sctsr: sctdr: scsmr: scscr: scssr: scbrr: scsptr: scsdcr: bus interface figure 13.1 block diagram of sci
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 529 of 1080 rej09b0230-0300 13.2 input/output pins the sci has the serial pins summarized in table 13.1. table 13.1 pin configuration channel pin name * i/o function 0 sck0 i/o sci0 clock input/output rxd0 input sci0 receive data input txd0 output sci0 transmit data output 1 sck1 i/o sci1 clock input/output rxd1 input sci1 receive data input txd1 output sci1 transmit data output 2 sck2 i/o sci2 clock input/output rxd2 input sci2 receive data input txd2 output sci2 transmit data output note: * pin names sck, rxd, and txd are used in the description for all channels, omitting the channel designation.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 530 of 1080 rej09b0230-0300 13.3 register descriptions the sci has the following register s for each channel. for details on register addresses and register states during each processing, refer to section 24, list of registers. table 13.2 register configuration chan- nel register name abbrevia- tion r/w initial value address access size 0 serial mode register_0 scsmr_0 r/w h'00 h'ffffc000 8 bit rate register_0 scbrr_0 r/w h'ff h'ffffc002 8 serial control register_0 scscr_0 r/w h'00 h'ffffc004 8 transmit data register_0 sctdr_0 ? ? h'ffffc006 8 serial status register_0 scssr_0 r/w h'84 h'ffffc008 8 receive data register_0 scrdr_0 ? ? h'ffffc00a 8 serial direction control register_0 scsdcr_0 r/w h'f2 h'ffffc00c 8 serial port register_0 scsptr_0 r/w h'0x h'ffffc00e 8 1 serial mode register_1 scsmr_1 r/w h'00 h'ffffc080 8 bit rate register_1 scbrr_1 r/w h'ff h'ffffc082 8 serial control register_1 scscr_1 r/w h'00 h'ffffc084 8 transmit data register_1 sctdr_1 ? ? h'ffffc086 8 serial status register_1 scssr_1 r/w h'84 h'ffffc088 8 receive data register_1 scrdr_1 ? ? h'ffffc08a 8 serial direction control register_1 scsdcr_1 r/w h'f2 h'ffffc08c 8 serial port register_1 scsptr_1 r/w h'0x h'ffffc08e 8 2 serial mode register_2 scsmr_2 r/w h'00 h'ffffc100 8 bit rate register_2 scbrr_2 r/w h'ff h'ffffc102 8 serial control register_2 scscr_2 r/w h'00 h'ffffc104 8 transmit data register_2 sctdr_2 ? ? h'ffffc106 8 serial status register_2 scssr_2 r/w h'84 h'ffffc108 8 receive data register_2 scrdr_2 ? ? h'ffffc10a 8 serial direction control register_2 scsdcr_2 r/w h'f2 h'ffffc10c 8 serial port register_2 scsptr_2 r/w h'0x h'ffffc10e 8
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 531 of 1080 rej09b0230-0300 13.3.1 receive shift register (scrsr) scrsr receives serial data. data input at the rxd pin is loaded into scrsr in the order received, lsb (bit 0) first, converting the data to parallel form. when one byte has been received, it is automatically transferred to scrdr. the cpu cannot read or write to scrsr directly. bit: initial value: r/w: 7654321 0 -------- -------- 13.3.2 receive data register (scrdr) scrdr is a register that stores serial receive da ta. after receiving one byte of serial data, the sci transfers the received data from the receive shif t register (scrsr) into scrdr for storage and completes operation. after that, sc rsr is ready to receive data. since scrsr and scrdr work as a double buffer in this way, data can be received continuously. scrdr is a read-only register and cannot be written to by the cpu. bit: initial value: r/w: 7654321 0 -------- -------- 13.3.3 transmit shift register (sctsr) sctsr transmits serial data. the sci loads transmit data from the transmit data register (sctdr) into sctsr, then transmits the data serially from the txd pin, lsb (bit 0) first. after transmitting one data byte, the sci automatically loads the next transmit data from sctdr into sctsr and starts transmitting again. if the tdre flag in the serial status register (scssr) is set to 1, the sci does not transfer data from sctdr to sctsr. the cpu cannot read or write to sctsr directly. bit: initial value: r/w: 7654321 0 -------- --------
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 532 of 1080 rej09b0230-0300 13.3.4 transmit data register (sctdr) sctdr is an 8-bit register that stores data for serial transmission. when the sci detects that the transmit shift register (sctsr) is empty, it moves transmit data written in the sctdr into sctsr and starts serial transmission. if the next transmit data has been written to sctdr during serial transmission from sctsr, the sci can tran smit data continuously. sctdr can always be written or read to by the cpu. bit: initial value: r/w: 7654321 0 -------- -------- 13.3.5 serial mode register (scsmr) scsmr is an 8-bit register that specifies the sci serial comm unication format and selects the clock source for the baud rate generator. the cpu can always read and write to scsmr. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w c/ a chr pe o/ e stop mp cks[1:0] bit bit name initial value r/w description 7 c/ a 0 r/w communication mode selects whether the sci operates in asynchronous or clock synchronous mode. 0: asynchronous mode 1: clock synchronous mode 6 chr 0 r/w character length selects 7-bit or 8-bit data in asynchronous mode. in the clock synchronous mode, the data length is always eight bits, regardless of the chr setting. when 7-bit data is selected, the msb (bit 7) of the transmit data register is not transmitted. 0: 8-bit data 1: 7-bit data
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 533 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 pe 0 r/w parity enable selects whether to add a parity bit to transmit data and to check the parity of receive data, in asynchronous mode. in clock synchronous mode, a parity bit is neither added nor checked, regardless of the pe setting. 0: parity bit not added or checked 1: parity bit added and checked * note: * when pe is set to 1, an even or odd parity bit is added to transmit data, depending on the parity mode (o/ e ) setting. receive data parity is checked according to the even/odd (o/ e ) mode setting. 4 o/ e 0 r/w parity mode selects even or odd parity when parity bits are added and checked. the o/ e setting is used only in asynchronous mode and only when the parity enable bit (pe) is set to 1 to enable parity addition and checking. the o/ e setting is ignored in clock synchronous mode, or in asynchronous mode when parity addition and checking is disabled. 0: even parity 1: odd parity if even parity is selected, the parity bit is added to transmit data to make an even number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an even number of 1s in the received character and parity bit combined. if odd parity is selected, the parity bit is added to transmit data to make an odd number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an odd number of 1s in the received character and parity bit combined.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 534 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 stop 0 r/w stop bit length selects one or two bits as the stop bit length in asynchronous mode. this setting is used only in asynchronous mode. it is ignored in clock synchronous mode because no stop bits are added. 0: one stop bit * 1 1: two stop bits * 2 when receiving, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1, it is treated as a stop bit, but if the second stop bit is 0, it is treated as the start bit of the next incoming character. notes: 1. when transmitting, a single 1-bit is added at the end of each transmitted character. 2. when transmitting, two 1 bits are added at the end of each transmitted character. 2 mp 0 r/w multiprocessor mode (only in asynchronous mode) enables or disables multiprocessor mode. the pe and o/ e bit settings are ignored in multiprocessor mode. 0: multiprocessor mode disabled 1: multiprocessor mode enabled 1, 0 cks[1:0] 00 r/w clock select 1 and 0 select the internal clock source of the on-chip baud rate generator. four clock sources are available. p , p /4, p /16 and p /64. for further information on the clock source, bit rate register settings, and baud rate, see section 13.3.10, bit rate register (scbrr). 00: p 01: p /4 10: p /16 11: p /64 note: p : peripheral clock
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 535 of 1080 rej09b0230-0300 13.3.6 serial control register (scscr) scscr is an 8-bit register th at enables or disables sci tr ansmission/reception and interrupt requests and selects the transmit/receive clock s ource. the cpu can always read and write to scscr. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w tie rie te re mpie teie cke[1:0] bit bit name initial value r/w description 7 tie 0 r/w transmit interrupt enable enables or disables a transmit-data-empty interrupt (txi) to be issued when the tdre flag in the serial status register (scssr) is set to 1 after serial transmit data is sent from the transmit data register (sctdr) to the transmit shift register (sctsr). txi can be canceled by clearing the tdre flag to 0 after reading tdre = 1 or by clearing the tie bit to 0. 0: transmit-data-empty interrupt request (txi) is disabled 1: transmit-data-empty interrupt request (txi) is enabled 6 rie 0 r/w receive interrupt enable enables or disables a receive-data-full interrupt (rxi) and a receive error interrupt (eri) to be issued when the rdrf flag in scssr is set to 1 after the serial data received is transferred from the receive shift register (scrsr) to the receive data register (scrdr). rxi can be canceled by clearing the rdrf flag after reading rdrf =1. eri can be canceled by clearing the fer, per, or orer flag to 0 after reading 1 from the flag. both rxi and eri can also be canceled by clearing the rie bit to 0. 0: receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are disabled 1: receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are enabled
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 536 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 te 0 r/w transmit enable enables or disables the sci serial transmitter. 0: transmitter disabled * 1 1: transmitter enabled * 2 notes: 1. the tdre flag in scssr is fixed at 1. 2. serial transmission starts after writing transmit data into sctdr and clearing the tdre flag in scssr to 0 while the transmitter is enabled. select the transmit format in the serial mode register (scsmr) before setting te to 1. 4 re 0 r/w receive enable enables or disables the sci serial receiver. 0: receiver disabled * 1 1: receiver enabled * 2 notes: 1. clearing re to 0 does not affect the receive flags (rdrf, fer, per, and orer). these flags retain their previous values. 2. serial reception starts when a start bit is detected in asynchronous mode, or synchronous clock input is detected in clock synchronous mode. select the receive format in scsmr before setting re to 1. 3 mpie 0 r/w multiprocessor interrupt enable (only when mp = 1 in scsmr in asynchronous mode) when this bit is set to 1, receive data in which the multiprocessor bit is 0 is skipped and setting of the rdrf, fer, and orer status flags in scssr is prohibited. on receiving data in which the multiprocessor bit is 1, this bit is automatically cleared to 0 and normal receiving operation is resumed. for details, refer to section 13.4.4, multiprocessor communication function.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 537 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 teie 0 r/w transmit end interrupt enable enables or disables a transmit end interrupt (tei) to be issued when no valid transmit data is found in sctdr during msb data transmission. tei can be canceled by clearing the tend flag to 0 (by clearing the tdre flag in scssr to 0 after reading tdre = 1) or by clearing the teie bit to 0. 0: transmit end interrupt request (tei) is disabled 1: transmit end interrupt request (tei) is enabled 1, 0 cke[1:0] 00 r/w clock enable 1 and 0 select the sci clock source and enable or disable clock output from the sck pin. depending on the combination of cke1 and cke0, the sck pin can be used for serial clock output or serial clock input. when selecting the clock output in clock synchronous mode, set the c/ a bit in scsmr to 1 and then set bits cke1 and cke0. for details on clock source selection, refer to table 13.14. ? asynchronous mode 00: internal clock, sck pin used for input pin (the input signal is ignored.) 01: internal clock, sck pin used for clock output * 1 10: external clock, sck pin used for clock input * 2 11: external clock, sck pin used for clock input * 2 ? clock synchronous mode 00: internal clock, sck pin used for synchronous clock output 01: internal clock, sck pin used for synchronous clock output 10: external clock, sck pin used for synchronous clock input 11: external clock, sck pin used for synchronous clock input notes: 1. the output clock frequency is 16 times the bit rate. 2. the input clock frequency is 16 times the bit rate.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 538 of 1080 rej09b0230-0300 13.3.7 serial status register (scssr) scssr is an 8-bit register that contains status flags to indicate the sci operating state. the cpu can always read and write to scssr, but cannot write 1 to status flags tdre, rdrf, orer, per, and fer. these flags can be cleared to 0 only after 1 is read from the flags. the tend flag is a read-only bit and cannot be modified. bit: initial value: r/w: 7654321 0 10000100 r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r r r/w tdre rdrf orer fer per tend mpb mpbt note: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. * bit bit name initial value r/w description 7 tdre 1 r/(w) * transmit data register empty indicates whether data has been transferred from the transmit data register (sctdr) to the transmit shift register (sctsr) and sctdr has become ready to be written with next serial transmit data. 0: indicates that sctdr holds valid transmit data [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dtc is activated by a txi interrupt and transmit data is transferred to sctdr while the disel bit of mrb in the dtc is 0 1: indicates that sctdr does not hold valid transmit data [setting conditions] ? by a power-on reset or in standby mode ? when the te bit in scscr is 0 ? when data is transferred from sctdr to sctsr and data can be written to sctdr
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 539 of 1080 rej09b0230-0300 bit bit name initial value r/w description 6 rdrf 0 r/(w) * receive data register full indicates that the received data is stored in the receive data register (scrdr). 0: indicates that valid received data is not stored in scrdr [clearing conditions] ? by a power-on reset or in standby mode ? when 0 is written to rdrf after reading rdrf = 1 ? when the dtc is activated by an rxi interrupt and data is transferred from scrdr while the disel bit of mrb in the dtc is 0 1: indicates that valid received data is stored in scrdr [setting condition] ? when serial reception ends normally and receive data is transferred from scrsr to scrdr note: scrdr and the rdrf flag are not affected and retain their previous states even if an error is detected during data reception or if the re bit in the serial control register (scscr) is cleared to 0. if reception of the next data is completed while the rdrf flag is still set to 1, an overrun error will occur and the received data will be lost.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 540 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 orer 0 r/(w) * overrun error indicates that an overrun error occurred during reception, causing abnormal termination. 0: indicates that reception is in progress or was completed successfully * 1 [clearing conditions] ? by a power-on reset or in standby mode ? when 0 is written to orer after reading orer = 1 1: indicates that an overrun error occurred during reception * 2 [setting condition] ? when the next serial reception is completed while rdrf = 1 notes: 1. the orer flag is not affected and retains its previous value when the re bit in scscr is cleared to 0. 2. the receive data prior to the overrun error is retained in scrdr, and the data received subsequently is lost. subsequent serial reception cannot be continued while the orer flag is set to 1.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 541 of 1080 rej09b0230-0300 bit bit name initial value r/w description 4 fer 0 r/(w) * framing error indicates that a framing error occurred during data reception in asynchronous mode, causing abnormal termination. 0: indicates that reception is in progress or was completed successfully * 1 [clearing conditions] ? by a power-on reset or in standby mode ? when 0 is written to fer after reading fer = 1 1: indicates that a framing error occurred during reception [setting condition] ? when the sci founds that the stop bit at the end of the received data is 0 after completing reception * 2 notes: 1. the fer flag is not affected and retains its previous value when the re bit in scscr is cleared to 0. 2. in 2-stop-bit mode, only the first stop bit is checked for a value to 1; the second stop bit is not checked. if a framing error occurs, the receive data is transferred to scrdr but the rdrf flag is not set. subsequent serial reception cannot be continued while the fer flag is set to 1.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 542 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 per 0 r/(w) * parity error indicates that a parity error occurred during data reception in asynchronous mode, causing abnormal termination. 0: indicates that reception is in progress or was completed successfully * 1 [clearing conditions] ? by a power-on reset or in standby mode ? when 0 is written to per after reading per = 1 1: indicates that a parity error occurred during reception * 2 [setting condition] ? when the number of 1s in the received data and parity does not match the even or odd parity specified by the o/ e bit in the serial mode register (scsmr). notes: 1. the per flag is not affected and retains its previous value when the re bit in scscr is cleared to 0. 2. if a parity error occurs, the receive data is transferred to scrdr but the rdrf flag is not set. subsequent serial reception cannot be continued while the per flag is set to 1.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 543 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 tend 1 r transmit end indicates that no valid data was in sctdr during transmission of the last bit of the transmit character and transmission has ended. the tend flag is read-only and cannot be modified. 0: indicates that transmission is in progress [clearing condition] ? when 0 is written to tdre after reading tdre = 1 1: indicates that transmission has ended [setting conditions] ? by a power-on reset or in standby mode ? when the te bit in scscr is 0 ? when tdre = 1 during transmission of the last bit of a 1-byte serial transmit character note: the tend flag value becomes undefined if data is written to sctdr by activating the dtc by a txi interrupt. in this case, do not use the tend flag as the transmit end flag. 1 mpb 0 r multiprocessor bit stores the multiprocessor bit found in the receive data. when the re bit in scscr is cleared to 0, its previous state is retained. 0 mpbt 0 r/w multiprocessor bit transfer specifies the multiprocessor bit value to be added to the transmit frame. note: * writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 544 of 1080 rej09b0230-0300 13.3.8 serial port re gister (scsptr) scsptr is an 8-bit register that controls input/output and data for the ports multiplexed with the sci function pins. data to be output through the txd pin can be specified to control break of serial transfer. through bits 3 and 2, data reading and writing through the sck pin can be specified. bit 7 enables or disables rxi interr upts. the cpu can always read and write to scsptr. when reading the value on the sci pins , use the respective port register. for details, refer to section 19, i/o ports. bit: initial value: r/w: 7654321 0 00000-0- r/w - - - r/w r/w r/w r/w eio - - - spb1io spb1dt spb0io spb0dt bit bit name initial value r/w description 7 eio 0 r/w error interrupt only enables or disables rxi interrupts. while the eio bit is set to 1, the sci does not request an rxi interrupt to the cpu even if the rie bit is set to 1. 0: the rie bit enables or disables rxi and eri interrupts. while the rie bit is 1, rxi and eri interrupts are sent to the intc. 1: while the rie bit is 1, only the eri interrupt is sent to the intc. 6 to 4 ? all 0 ? reserved these bits are always read as 0. the write value should always be 0. 3 spb1io 0 r/w clock port input/output in serial port specifies the input/output direction of the sck pin in the serial port. to output the data specified in the spb1dt bit through the sck pin as a port output pin, set the c/ a bit in scsmr and the cke1 and cke0 bits in scscr to 0. 0: does not output the spb1dt bit value through the sck pin. 1: outputs the spb1dt bit value through the sck pin.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 545 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 spb1dt undefined r/w clock port data in serial port specifies the data output through the sck pin in the serial port. output should be enabled by the spb1io bit (for details, refer to the spb1io bit description). when output is enabled, the spb1dt bit value is output through the sck pin. 0: low level is output 1: high level is output 1 spb0io 0 r/w serial port break input/output together with the spb0dt bit and the te bit in scscr, controls the txd pin. serial port break data together with the spb0io bit and te bit in scscr, controls the txd pin. note that the txd pin function needs to have been selected with the pin function controller (pfc). te bit setting in scscr spb0io bit setting spb0dt bit setting state of txd pin 0 0 * spb0dt output disabled (initial state) 0 1 0 output, low level 0 1 1 output, high level 0 spb0dt undefined r/w 1 * * output for transmit data in accord with the serial core logic note: * don't care
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 546 of 1080 rej09b0230-0300 13.3.9 serial direction cont rol register (scsdcr) the dir bit in the serial direction control regi ster (scsdcr) selects lsb-first or msb-first transfer. with an 8-bit data length, lsb-first/msb-first selection is available regardless of the communication mode. bit: initial value: r/w: 7654321 0 11110010 rrrrr/wrrr ----dir--- bit bit name initial value r/w description 7 to 4 ? all 1 r reserved these bits are always read as 1. the write value should always be 1. 3 dir 0 r/w data transfer direction selects the serial/parallel conversion format. valid for an 8-bit transmit/receive format. 0: sctdr contents are transmitted in lsb-first order receive data is stored in scrdr in lsb-first 1: sctdr contents are transmitted in msb-first order receive data is stored in scrdr in msb-first 2 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 1 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 0 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 547 of 1080 rej09b0230-0300 13.3.10 bit rate register (scbrr) scbrr is an 8-bit register that, together with the baud rate generator clock source selected by the cks1 and cks0 bits in the serial mode register (scsmr), determines th e serial transmit/receive bit rate. the cpu can always read and write to scbrr. the scbrr setting is calculated as follows: bit: initial value: r/w: 7654321 0 11111111 r/w r/w r/w r/w r/w r/w r/w r/w ? asynchronous mode: n = 10 6 - 1 64 2 2n-1 b p ? clock synchronous mode: n = 10 6 - 1 8 2 2n-1 b p b: bit rate (bits/s) n: scbrr setting for baud rate generator (0 n 255) (the setting value should satisfy the electrical characteristics.) p : operating frequency for peripheral modules (mhz) n: baud rate generator clock source (n = 0, 1, 2, 3) (for the clock sources and values of n, see table 13.3.)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 548 of 1080 rej09b0230-0300 table 13.3 scsmr settings scsmr settings n clock source cks1 cks0 0 p 0 0 1 p /4 0 1 2 p /16 1 0 3 p /64 1 1 note: the bit rate error in asynchronous is given by the following formula: error (%) = - 1 100 (n + 1) b 64 2 2n-1 p 10 6 tables 13.4 to 13.6 show examples of scbrr settings in asynchronous mode, and tables 13.7 to 13.9 show examples of scbrr settings in clock synchronous mode.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 549 of 1080 rej09b0230-0300 table 13.4 bit rates and scbrr settings in asynchronous mode (1) p (mhz) 10 12 14 16 18 20 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) 110 2 177 -0.25 2 212 0.03 2 248 -0.17 3 70 0.03 3 79 -0.12 3 88 -0.25 150 2 129 0.16 2 155 0.16 2 181 0.16 2 207 0.16 2 233 0.16 3 64 0.16 300 2 64 0.16 2 77 0.16 2 90 0.16 2 103 0.16 2 116 0.16 2 129 0.16 600 1 129 0.16 1 155 0.16 1 181 0.16 1 207 0.16 1 233 0.16 2 64 0.16 1200 1 64 0.16 1 77 0.16 1 90 0.16 1 103 0.16 1 116 0.16 1 129 0.16 2400 0 129 0.16 0 155 0.16 0 181 0.16 0 207 0.16 0 233 0.16 1 64 0.16 4800 0 64 0.16 0 77 0.16 0 90 0.16 0 103 0.16 0 116 0.16 0 129 0.16 9600 0 32 -1.36 0 38 0.16 0 45 -0.93 0 51 0.16 0 58 -0.69 0 64 0.16 14400 0 21 -1.36 0 25 0.16 0 29 1.27 0 34 -0.79 0 38 0.16 0 42 0.94 19200 0 15 1.73 0 19 -2.34 0 22 -0.93 0 25 0.16 0 28 1.02 0 32 -1.36 28800 0 10 -1.36 0 12 0.16 0 14 1.27 0 16 2.12 0 19 -2.34 0 21 -1.36 31250 0 9 0.00 0 11 0.00 0 13 0.00 0 15 0.00 0 17 0.00 0 19 0.00 38400 0 7 1.73 0 9 -2.34 0 10 3.57 0 12 0.16 0 14 -2.34 0 15 1.73
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 550 of 1080 rej09b0230-0300 table 13.5 bit rates and scbrr settings in asynchronous mode (2) p (mhz) 22 24 26 28 30 32 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) 110 3 97 -0.35 3 106 -0.44 3 114 0.36 3 123 0.23 3 132 0.13 3 141 0.03 150 3 71 -0.54 3 77 0.16 3 84 -0.43 3 90 0.16 3 97 -0.35 3 103 0.16 300 2 142 0.16 2 155 0.16 2 168 0.16 2 181 0.16 2 194 0.16 2 207 0.16 600 2 71 -0.54 2 77 0.16 2 84 -0.43 2 90 0.16 2 97 -0.35 2 103 0.16 1200 1 142 0.16 1 155 0.16 1 168 0.16 1 181 0.16 1 194 0.16 1 207 0.16 2400 1 71 -0.54 1 77 0.16 1 84 -0.43 1 90 0.16 1 97 -0.35 1 103 0.16 4800 0 142 0.16 0 155 0.16 0 168 0.16 0 181 0.16 0 194 0.16 0 207 0.16 9600 0 71 -0.54 0 77 0.16 0 84 -0.43 0 90 0.16 0 97 -0.35 0 103 0.16 14400 0 47 -0.54 0 51 0.16 0 55 0.76 0 60 -0.39 0 64 0.16 0 68 0.64 19200 0 35 -0.54 0 38 0.16 0 41 0.76 0 45 -0.93 0 48 -0.35 0 51 0.16 28800 0 23 -0.54 0 25 0.16 0 27 0.76 0 29 1.27 0 32 -1.36 0 34 -0.79 31250 0 21 0.00 0 23 0.00 0 25 0.00 0 27 0.00 0 29 0.00 0 31 0.00 38400 0 17 -0.54 0 19 -2.34 0 20 0.76 0 22 -0.93 0 23 1.73 0 25 0.16
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 551 of 1080 rej09b0230-0300 table 13.6 bit rates and scbrr settings in asynchronous mode (3) p (mhz) 34 36 38 40 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) 110 3 150 -0.05 3 159 -0.12 3 168 -0.19 3 177 -0.25 150 3 110 -0.29 3 116 0.16 3 123 -0.24 3 129 0.16 300 2 220 0.16 2 233 0.16 2 246 0.16 3 64 0.16 600 2 110 -0.29 2 116 0.16 2 123 -0.24 2 129 0.16 1200 1 220 0.16 1 233 0.16 1 246 0.16 2 64 0.16 2400 1 110 -0.29 1 116 0.16 1 123 -0.24 1 129 0.16 4800 0 220 0.16 0 233 0.16 0 246 0.16 1 64 0.16 9600 0 110 -0.29 0 116 0.16 0 123 -0.24 0 129 0.16 14400 0 73 -0.29 0 77 0.16 0 81 0.57 0 86 -0.22 19200 0 54 0.62 0 58 -0.69 0 61 -0.24 0 64 0.16 28800 0 36 -0.29 0 38 0.16 0 40 0.57 0 42 0.94 31250 0 33 0.00 0 35 0.00 0 37 0.00 0 39 0.00 38400 0 27 -1.18 0 28 1.02 0 30 -0.24 0 32 -1.36
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 552 of 1080 rej09b0230-0300 table 13.7 bit rates and scbrr settings in clock synchronous mode (1) p (mhz) 10 12 14 16 18 20 bit rate (bits/s) n n n n n n n n n n n n 250 3 155 3 187 3 218 3 249 500 3 77 3 93 3 108 3 124 3 140 3 155 1000 2 155 2 187 2 218 2 249 3 69 3 77 2500 1 249 2 74 2 87 2 99 2 112 2 124 5000 1 124 1 149 1 174 1 199 1 224 1 249 10000 0 249 1 74 1 87 1 99 1 112 1 124 25000 0 99 0 119 0 139 0 159 0 179 0 199 50000 0 49 0 59 0 69 0 79 0 89 0 99 100000 0 24 0 29 0 34 0 39 0 44 0 49 250000 0 9 0 11 0 13 0 15 0 17 0 19 500000 0 4 0 5 0 6 0 7 0 8 0 9 1000000 ? ? 0 2 ? ? 0 3 ? ? 0 4 2500000 0 0 * ? ? ? ? ? ? ? ? 0 1 5000000 ? ? ? ? ? ? ? ? 0 0 *
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 553 of 1080 rej09b0230-0300 table 13.8 bit rates and scbrr settings in clock synchronous mode (2) p (mhz) 22 24 26 28 30 32 bit rate (bits/s) n n n n n n n n n n n n 250 500 3 171 3 187 3 202 3 218 3 233 3 249 1000 3 85 3 93 3 101 3 108 3 116 3 124 2500 2 137 2 149 2 162 2 174 2 187 2 199 5000 2 68 2 74 2 80 2 87 2 93 2 99 10000 1 137 1 149 1 162 1 174 1 187 1 199 25000 0 219 0 239 1 64 1 69 1 74 1 79 50000 0 109 0 119 0 129 0 139 0 149 0 159 100000 0 54 0 59 0 64 0 69 0 74 0 79 250000 0 21 0 23 0 25 0 27 0 29 0 31 500000 0 10 0 11 0 12 0 13 0 14 0 15 1000000 ? ? 0 5 ? ? 0 6 ? ? 0 7 2500000 ? ? ? ? ? ? ? ? 0 2 ? ? 5000000 ? ? ? ? ? ? ? ? ? ? ? ?
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 554 of 1080 rej09b0230-0300 table 13.9 bit rates and scbrr settings in clock synchronous mode (3) p (mhz) 34 36 38 40 bit rate (bits/s) n n n n n n n n 250 500 1000 3 132 3 140 3 147 3 155 2500 2 212 2 224 2 237 2 249 5000 2 105 2 112 2 118 2 124 10000 1 212 1 224 1 237 1 249 25000 1 84 1 89 1 94 1 99 50000 0 169 0 179 0 189 0 199 100000 0 84 0 89 0 94 0 99 250000 0 33 0 35 0 37 0 39 500000 0 16 0 17 0 18 0 19 1000000 ? ? 0 8 ? ? 0 9 2500000 ? ? ? ? ? ? 0 3 5000000 ? ? ? ? ? ? 0 1 [legend] blank: no setting possible ? : setting possible, but error occurs * : continuous transmission/reception is disabled. note: settings with an error of 1% or less are recommended.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 555 of 1080 rej09b0230-0300 table 13.10 indicates the maximum bit rates in asynchronous mode when the baud rate generator is used. tables 13.11 and 13.12 list the maximum rates for external clock input. table 13.10 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) settings p (mhz) maximum bit rate (bits/s) n n 10 312500 0 0 12 375000 0 0 14 437500 0 0 16 500000 0 0 18 562500 0 0 20 625000 0 0 22 687500 0 0 24 750000 0 0 26 812500 0 0 28 875000 0 0 30 937500 0 0 32 1000000 0 0 34 1062500 0 0 36 1125000 0 0 38 1187500 0 0 40 1250000 0 0
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 556 of 1080 rej09b0230-0300 table 13.11 maximum bit rates with external clock input (asynchronous mode) p (mhz) external input clock (m hz) maximum bit rate (bits/s) 10 2.5000 156250 12 3.0000 187500 14 3.5000 218750 16 4.0000 250000 18 4.5000 281250 20 5.0000 312500 22 5.5000 343750 24 6.0000 375000 26 6.5000 406250 28 7.0000 437500 30 7.5000 468750 32 8.0000 500000 34 8.5000 531250 36 9.0000 562500 38 9.5000 593750 40 10.0000 625000
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 557 of 1080 rej09b0230-0300 table 13.12 maximum bit rates with external clock input (clock synchronous mode) p (mhz) external input clock (m hz) maximum bit rate (bits/s) 10 1.6667 1666666.7 12 2.0000 2000000.0 14 2.3333 2333333.3 16 2.6667 2666666.7 18 3.0000 3000000.0 20 3.3333 3333333.3 22 3.6667 3666666.7 24 4.0000 4000000.0 26 4.3333 4333333.3 28 4.6667 4666666.7 30 5.0000 5000000.0 32 5.3333 5333333.3 34 5.6667 5666666.7 36 6.0000 6000000.0 38 6.3333 6333333.3 40 6.6667 6666666.7
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 558 of 1080 rej09b0230-0300 13.4 operation 13.4.1 overview for serial communication, the sci has an asynchronous mode in which characters are synchronized individually, and a clock synchronous mode in which communication is synchronized with clock pulses. asynchronous or clock synchronous mode is selected and the transmit format is specified in the serial mode register (scsmr) as shown in table 13.13. the sci clock source is selected by the combination of the c/ a bit in scsmr and the cke1 and cke0 bits in the serial control register (scscr) as shown in table 13.14. (1) asynchronous mode ? data length is selectable: 7 or 8 bits. ? parity bit is selectable. so is the stop bit length (1 or 2 bits). the combination of the preceding selections constitutes the communication format and character length. ? in receiving, it is possible to detect framing er rors, parity errors, overrun errors, and breaks. ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the clock supplied by the on- chip baud rate generator and can output a clock with a frequency 16 times the bit rate. ? when an external clock is sel ected, the external clock input must have a frequency 16 times the bit rate. (the on-chip baud rate generator is not used.) (2) clock synchronous mode ? the transmission/reception format has a fixed 8-bit data length. ? in receiving, it is possible to detect overrun errors. ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the on-chip baud rate generator, and outputs a serial clock signal to external devices. ? when an external clock is selected, the sci operates on the input serial clock. the on-chip baud rate generator is not used.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 559 of 1080 rej09b0230-0300 table 13.13 scsmr settings and sci communication formats scsmr settings sci communication format bit 7 c/ a bit 6 chr bit 5 pe bit 3 stop mode data length parity bit stop bit length 0 0 0 0 8-bit not set 1 bit 1 2 bits 1 0 set 1 bit 1 2 bits 1 0 0 7-bit not set 1 bit 1 2 bits 1 0 set 1 bit 1 asynchronous 2 bits 1 x x x clock synchronous 8-bit not set none [legend] x: don't care table 13.14 scsmr and scscr setting s and sci clock source selection scsmr scscr settings bit 7 c/ a bit 1 cke1 bit 0 cke0 mode clock source sck pin function 0 0 0 asynchronous internal sci does not use the sck pin. 1 clock with a frequency 16 times the bit rate is output. 1 0 1 external input a clock with frequency 16 times the bit rate. 1 0 0 internal serial clock is output. 1 clock synchronous 1 0 external input the serial clock. 1
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 560 of 1080 rej09b0230-0300 13.4.2 operation in asynchronous mode in asynchronous mode, each transmitted or received character begins with a start bit and ends with a stop bit. serial communication is s ynchronized one character at a time. the transmitting and receiving sections of the sci are independent, so full duplex communication is possible. both the transmitter and receiver have a double-buffered structure so that data can be read or written during transmission or recep tion, enabling continuous data transfer. figure 13.2 shows the general format of asynchronous serial communication. in asynchronous serial communication, the communica tion line is normally held in the mark (high) state. the sci monitors the line and starts se rial communication when the line goes to the space (low) state, indicating a start bit. one serial character consists of a start bit (low), data (lsb first), parity bit (high or low), and stop bit (high), in that order. when receiving in asynchronous mode, the sci synchr onizes at the falling edge of the start bit. the sci samples each data bit on the eighth pulse of a clock with a frequency 16 times the bit rate. receive data is latched at the center of each bit. lsb start bit msb idle state (mark state) stop bit 0 transmit/receive data d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 1 1 serial data parity bit 1 bit 1 or 2 bits 7 or 8 bits 1 bit or none one unit of transfer data (character or frame) figure 13.2 example of data format in asynchronous communication (8-bit data with parity and two stop bits)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 561 of 1080 rej09b0230-0300 (1) transmit/receive formats table 13.15 shows the transfer formats that can be selected in asynchronous mode. any of 12 transfer formats can be selected according to the scsmr settings. table 13.15 serial transfer formats (asynchronous mode) pe 0 0 1 1 0 0 1 1 x x x x s 8-bit data stop s 7-bit data stop s 8-bit data stop stop s 8-bit data p stop s 7-bit data stop p s 8-bit data mpb stop s 8-bit data mpb stop stop s 7-bit data stop mpb s 7-bit data stop mpb stop s 7-bit data stop stop chr 0 0 0 0 1 1 1 1 0 0 1 1 mp 0 0 0 0 0 0 0 0 1 1 1 1 stop 0 1 0 1 0 1 0 1 0 1 0 1 scsmr settings 1234567 8 9101112 serial transfer format and frame length stop s 8-bit data p stop s 7-bit data stop p stop [le g end] s: start bit stop: stop bit p: parity bit mpb: multiprocessor bit x: don't care
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 562 of 1080 rej09b0230-0300 (2) clock an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in the serial mode register (scsmr) and bits cke1 and cke0 in the serial control register (scscr) (table 13.14). when an external clock is input at the sck pin, it must have a frequency equal to 16 times the desired bit rate. when the sci operates on an internal clock, it can output a clock signal at the sck pin. the frequency of this output clock is equal to 16 times the desired bit rate. (3) transmitting and receiving data sci initialization (asynchronous mode): before transmitting or receiving, clear the te and re bits to 0 in the serial control register (scscr), then initialize the sci as follows. when changing the operation mode or the communi cation format, always clear the te and re bits to 0 before following the procedure given below. clearing the te bit to 0 sets the tdre flag to 1 and initializes the transmit shift register (sctsr). clearing the re bit to 0, however, does not initialize the rdrf, per, fer, and orer flags or receive data register (scrdr), which retain their previous contents. when an external clock is used, the clock should not be stopped during initia lization or subsequent operation. sci operation becomes unreliable if the clock is stopped.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 563 of 1080 rej09b0230-0300 wait yes [1] start initialization clear rie, tie, teie, mpie, te, and re bits in scscr to 0 * [2] no set value in scbrr [3] [4] [5] 1-bit interval elapsed? < initialization completed> [1] set the clock selection in scscr. [2] set the data transfer format in scsmr and scsdcr. [3] write a value correspondin g to the bit rate to scbrr. not necessary if an external clock is used. [4] set pfc of the external pin used. set rxd input durin g receivin g and txd output durin g transmittin g . set sck input/output accordin g to contents set by cke1 and cke0. when cke1 and cke0 are 0 in asynchronous mode, settin g the sck pin is unnecessary. outputtin g clocks from the sck pin starts at synchronous clock output settin g . [5] set the te bit or re bit in scscr to 1. * also make settin g s of the rie, tie, teie, and mpie bits. at this time, the txd, rxd, and sck pins are ready to be used. the txd pin is in a mark state durin g transmittin g , and rxd pin is in an idle state for waitin g the start bit durin g receivin g . set data transfer format in scsmr set the pfc for the external pins to be used (sck, txd, rxd) set te and re bits of scscr to 1 set the rie, tie, teie, and mpie bits in scscr set cke1 and cke0 bits in scscr (te and re bits are 0) note : * in simultaneous transmit/receive operation, the te and re bits must be cleared to 0 or set to 1 simultaneously. figure 13.3 sample flowchart for sci initialization
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 564 of 1080 rej09b0230-0300 transmitting serial data (asynchronous mode): figure 13.4 shows a sample flowchart for serial transmission. use the following procedure for serial data tran smission after enabling the sci for transmission. start of transmission read tdre fla g in scssr tdre = 1? write transmit data in sctdr and clear tdre bit in scssr to 0 all data transmitted? read tend fla g in scssr tend = 1? break output? clear spb0dt to 0 and set spb0io to 1 clear te bit in scscr to 0 end of transmission no yes no yes no yes no yes [1] sci status check and transmit data write: read scssr and check that the tdre fla g is set to 1, then write transmit data to sctdr, and clear the tdre fla g to 0. [2] serial transmission continuation procedure: to continue serial transmission, read 1 from the tdre fla g to confirm that writin g is possible, then write data to sctdr, and then clear the tdre fla g to 0. checkin g and clearin g of the tdre fla g is automatic when the dtc is activated by a transmit data empty interrupt (txi) request, and data is written to sctdr. [3] break output at the end of serial transmission: to output a break in serial transmission, clear the spb0dt bit to 0 and set the spb0io bit to 1 in scsptr, then clear the te bit in scscr to 0. figure 13.4 sample flowchart for transmitting serial data
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 565 of 1080 rej09b0230-0300 in serial transmission, the sci operates as described below. 1. the sci monitors the tdre flag in the serial status register (s cssr). if it is cleared to 0, the sci recognizes that data has been written to th e transmit data register (sctdr) and transfers the data from sctdr to the transmit shift register (sctsr). 2. after transferring data from sctdr to sctsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit in the serial control register (scscr) is set to 1 at this time, a transmit-data-empty interrupt (txi) request is generated. the serial transmit data is sent from the txd pin in the following order. a. start bit: one-bit 0 is output. b. transmit data: 8-bit or 7-bit data is output in lsb-first order. c. parity bit or multiprocessor bit: one parity bit (even or odd parity) or one multiprocessor bit is output. (a format in which neither parity nor multiprocessor bit is output can also be selected.) d. stop bit(s): one or two 1 bits (stop bits) are output. e. mark state: 1 is output continuously until the start bit that starts the next transmission is sent. 3. the sci checks the tdre flag at the timing for sending the stop bit. if the tdre flag is 0, the data is transferred from sctdr to sctsr, the stop bit is sent, and then serial transmission of the next frame is started. if the tdre flag is 1, the tend flag in scssr is set to 1, the stop bit is sent, and then the "mark state" is entered in which 1 is output. if the teie bit in scscr is set to 1 at this time, a tei interrupt request is generated.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 566 of 1080 rej09b0230-0300 figure 13.5 shows an example of the operation for transmission. 1 0 d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 1 1 tdre tend serial data start bit data parity bit stop bit start bit idle state (mark state) data parity bit stop bit txi interrupt request data written to sctdr and tdre fla g cleared to 0 by txi interrupt handler one frame txi interrupt request tei interrupt request figure 13.5 example of transmission in asynchronous mode (8-bit data, parity, one stop bit)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 567 of 1080 rej09b0230-0300 receiving serial data (asynchronous mode): figure 13.6 shows a sample flow chart for serial reception. use the following procedure for serial data r eception after enabling the sci for reception. start of reception read orer, per, and fer fla g s in scssr per, fer, or orer = 1? read rdrf fla g in scssr rdrf = 1? read receive data in scrdr, and clear rdrf fla g in scssr to 0 all data received? clear re bit in scscr to 0 end of reception yes no yes yes no no error handlin g [1] receive error handlin g and break detection: if a receive error occurs, read the orer, per, and fer fla g s in scssr to identify the error. after performin g the appropriate error processin g , ensure that the orer, per, and fer fla g s are all cleared to 0. reception cannot be resumed if any of these fla g s are set to 1. in the case of a framin g error, a break can also be detected by readin g the value of the rxd pin. [2] sci status check and receive data read: read scssr and check that rdrf = 1, then read the receive data in scrdr clear the rdrf fla g to 0. [3] serial reception continuation procedure: to continue serial reception, clear the rdrf fla g to 0 before the stop bit for the current frame is received. the rdrf fla g is cleared automatically when the data transfer controller (dtc) is activated to read the scrdr value, and this step is not needed. figure 13.6 sample flowchart for receiving serial data (1)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 568 of 1080 rej09b0230-0300 error processin g parity error processin g yes no clear orer, per, and fer fla g s in scssr to 0 no yes no yes framin g error processin g no yes overrun error processin g orer = 1? fer = 1? break? per = 1? clear re bit in scscr to 0 figure 13.6 sample flowchart for receiving serial data (2)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 569 of 1080 rej09b0230-0300 in serial reception, the sci op erates as described below. 1. the sci monitors the transmission line, and if a 0 start bit is detected, performs internal synchronization and starts reception. 2. the received data is stored in scrsr in lsb-to-msb order. 3. the parity bit and stop bit are received. after receiving these bits, the sci carries out the following checks. a. parity check: th e sci counts the number of 1s in th e received data and checks whether the count matches the even or odd parity specified by the o/ e bit in the serial mode register (scsmr). b. stop bit check: the sci checks wh ether the stop bit is 1. if there are two stop bits, only the first is checked. c. status check: the sci checks whether the rdrf flag is 0 and the received data can be transferred from the receive shift register (scrsr) to scrdr. if all the above checks are passed, the rdrf flag is set to 1 and the received data is stored in scrdr. if a receive error is detected, th e sci operates as shown in table 13.16 note: when a receive error occurs, subsequent reception cannot be continued. in addition, the rdrf flag will not be set to 1 after reception; be sure to clear the error flag to 0. 4. if the eio bit in scsptr is cleared to 0 and the rie bit in scscr is set to 1 when the rdrf flag changes to 1, a receive-dat a-full interrupt (rxi) request is generated. if the rie bit in scscr is set to 1 when the orer, per, or fer flag changes to 1, a receive error interrupt (eri) request is generated. table 13.16 receive errors and error conditions receive error abbreviation error condition data transfer overrun error orer when the next data reception is completed while the rdrf flag in scssr is set to 1 the received data is not transferred from scrsr to scrdr. framing error fer when the stop bit is 0 the received data is transferred from scrsr to scrdr. parity error per when the received data does not match the even or odd parity specified in scsmr the received data is transferred from scrsr to scrdr.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 570 of 1080 rej09b0230-0300 figure 13.7 shows an example of the operation for reception. 1 0 d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 0/1 1 rdrf fer serial data start bit data parity bit stop bit start bit data parity bit stop bit rxi interrupt request one frame data read and rdrf fla g cleared to 0 by rxi interrupt handler eri interrupt request g enerated by framin g error figure 13.7 example of sci receive operation (8-bit data, parity, one stop bit) 13.4.3 clock synchronous mode in clock synchronous mode, the scif transmits and receives data in s ynchronization with clock pulses. this mode is suitable for high-speed serial communication. the sci transmitter and receiver are independent, so full-duplex communication is possible while sharing the same clock. both the transmitter and r eceiver have a double-buffered structure so that data can be read or written during transmission or reception, enabling continuous data transfer. figure 13.8 shows the general format in clock synchronous serial communication. don ' t care don ' t care one unit of transfer data (character or frame) bit 0 serial data synchronization clock bit 1 bit 3 bit 4 bit 5 lsb msb bit 2 bit 6 bit 7 * * note: * hi g h level except in continuous transfer figure 13.8 data format in clock synchronous communication
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 571 of 1080 rej09b0230-0300 in clock synchronous serial communication, each data bit is output on the communication line from one falling edge of the serial clock to the next. data is guaranteed valid at the rising edge of the serial clock. in each character, the serial data bits are transmitted in order from the lsb (first) to the msb (last). after output of the msb, the communication line remains in the state of the msb. in clock synchronous mode, the sci transm its or receives data by synchronizing with the rising edge of the serial clock. (1) communication format the data length is fixed at eight bits. no parity bit can be added. (2) clock an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the sci transmit/receive clock. for selection of the sci clock source, see table 13.14. when the sci operates on an internal clock, it outputs the clock signal at the sck pin. eight clock pulses are output per transmitted or received ch aracter. when the sci is not transmitting or receiving, the clock signal remains in the high stat e. when only reception is performed, output of the synchronous clock continues until an overrun error occurs or the re bit is cleared to 0. for the reception of n characters, select th e external clock as the clock sour ce. if the internal clock has to be used, set re and te to 1, then transmit n characters of dummy data at the same time as receiving the n characters of data. (3) transmitting and receiving data sci initialization (clock synchronous mode): before transmitting, receiving, or changing the mode or communication format, the software must clear the te and re bits to 0 in the serial control register (scscr), then initialize the sci. clearing te to 0 sets the tdre flag to 1 and initializes the transmit shift register (sctsr). clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags and receive data register (scrdr), which retain their previous contents.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 572 of 1080 rej09b0230-0300 figure 13.9 shows a sample flowchart for initializing the sci. wait no yes start initialization set data transfer format in scsmr set value in scbrr clear rie, tie, teie, mpie, te and re bits in scscr to 0 * [2] [3] [4] [5] 1-bit interval elapsed? set the pfc for the external pins to be used (sck, txd, rxd) set cke1 and cke0 bits in scscr (te and re bits are 0) [1] [1] set the clock selection in scscr. [2] set the data transfer format in scsmr. [3] write a value correspondin g to the bit rate to scbrr. not necessary if an external clock is used. [4] set pfc of the external pin used. set rxd input durin g receivin g and txd output durin g transmittin g . set sck input/output accordin g to contents set by cke1 and cke0. [5] set the te bit or re bit in scr to 1. * also make settin g s of the rie, tie, teie, and mpie bits. at this time, the txd, rxd, and sck pins are ready to be used. the txd pin is in a mark state durin g transmittin g . when synchronous clock output (clock master) is set durin g receivin g in clock synchronous mode, outputtin g clocks from the sck pin starts. note: * in simultaneous transmit and receive operations, the te and re bits should both be cleared to 0 or set to 1 simultaneously. set te and re bits of scscr to 1 set the rie, tie, teie, and mpie bits in scscr figure 13.9 sample flowchart for sci initialization
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 573 of 1080 rej09b0230-0300 transmitting serial data (clock synchronous mode): figure 13.10 shows a sample flowchart for transmitting serial data. use the following procedure for serial data tran smission after enabling the sci for transmission. start of transmission read tdre fla g in scssr tdre = 1? write transmit data to sctdr and clear tdre fla g in scssr to 0 all data transmitted? read tend fla g in scssr tend = 1? clear te bit in scscr to 0 end of transmission no yes no yes no yes [1] sci status check and transmit data write: read scssr and check that the tdre fla g is set to 1, then write transmit data to sctdr, and clear the tdre fla g to 0. [2] serial transmission continuation procedure: to continue serial transmission, read 1 from the tdre fla g to confirm that writin g is possible, then write data to sctdr, and then clear the tdre fla g to 0. checkin g and clearin g of the tdre fla g is automatic when the dtc is activated by a transmit data empty interrupt (txi) request, and data is written to sctdr. figure 13.10 sample flowchart for transmitting serial data
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 574 of 1080 rej09b0230-0300 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre flag in the serial status register (s cssr). if it is cleared to 0, the sci recognizes that data has been written to th e transmit data register (sctdr) and transfers the data from sctdr to the transmit shift register (sctsr). 2. after transferring data from sctdr to sctsr, the sci sets the tdre flag to 1 and starts transmission. if the transmit-data-empty interrupt enable bit (tie) in the serial control register (scscr) is set to 1 at this time, a transmit-data-empty interrupt (txi) request is generated. if clock output mode is selected, the sci outputs eight synchronous clock pulses. if an external clock source is selected, the sci outputs data in synchronization with the input clock. data is output from the txd pin in order from the lsb (bit 0) to the msb (bit 7). 3. the sci checks the tdre flag at the timing for sending the msb (bit 7). if the tdre flag is 0, the data is transferred from sctdr to sctsr and serial transmission of the next frame is started, if the tdre flag is 1, the tend flag in scssr is set to 1, the msb (bit 7) is sent, and then the txd pin holds the states. if the teie bit in scscr is set to 1 at this time, a tei interrupt request is generated. 4. after the end of serial transmission, the sck pin is held in the high state. figure 13.11 shows an example of sci transmit operation. synchronization clock serial data bit 0 bit 1 bit 7 bit 0 bit 1 bit 6 bit 7 lsb msb data written to sctdr and tdre fla g cleared to 0 by txi interrupt handler tdre tend txi interrupt request txi interrupt request one frame tei interrupt request transfer direction figure 13.11 example of sci transmit operation
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 575 of 1080 rej09b0230-0300 receiving serial data (clock synchronous mode): figure 13.12 shows a sample flowchart for receiving serial data. use the follo wing procedure for serial data reception after enabling the scif for reception. when switching from asynchronous mode to clock synchronous mode, make sure that the orer, per, and fer flags are all cleared to 0. if the fer or per flag is set to 1, the rdrf flag will not be set and data reception cannot be started. start of reception read orer fla g in scssr orer = 1? read rdrf fla g in scsmr rdrf = 1? set the cke1 and cke0 bits in scscr (te and re bits are 0) all data received? clear re bit in scscr to 0 end of reception yes no yes yes no no error handlin g [1] receive error handlin g : read the orer fla g in scssr to identify any error, perform the appropriate error handlin g , then clear the orer fla g to 0. reception cannot be resumed while the orer fla g is set to 1. [2] sci status check and receive data read: read scssr and check that rdrf = 1, then read the receive data in scrdr, and clear the rdrf fla g to 0. the transition of the rdrf fla g from 0 to 1 can also be identified by an rxi interrupt. [3] serial reception continuation procedure: to continue serial reception, read the receive data re g ister (scrdr) and clear the rdrf fla g to 0 before the msb (bit 7) of the current frame is received. the rdrf fla g is cleared automatically when the data transfer controller (dtc) is activated by a receive-data-full interrupt (rxi) request to read the scrdr value, and this step is not needed. figure 13.12 sample flowchart for receivi ng serial data (1)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 576 of 1080 rej09b0230-0300 error handlin g clear orer fla g in scssr to 0 end overrun error handlin g orer = 1? yes no figure 13.12 sample flowchart for receivi ng serial data (2) in receiving, the sci operates as follows: 1. the sci synchronizes with serial clock input or output and initializes internally. 2. receive data is shifted into scrsr in orde r from the lsb to the msb. after receiving the data, the sci checks whether the rdrf flag is 0 and the receive data can be transferred from scrsr to scrdr. if this check is passed, the sci sets the rdrf flag to 1 and stores the received data in scrdr. if a receive error is detected, the sci operates as shown in table 13.16. in this state, subsequent reception cannot be continued. in addition, the rdrf flag will not be set to 1 after reception; be sure to clear the rdrf flag to 0. 3. after setting rdrf to 1, if the receive-data- full interrupt enable bit (rie) is set to 1 in scscr, the sci requests a receive-data-full interrupt (rxi). if the orer bit is set to 1 and the rie bit in scscr is also set to 1, the sci requests a receive error interrupt (eri).
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 577 of 1080 rej09b0230-0300 figure 13.13 shows an example of sci receive operation. synchronization clock serial data bit 7 bit 0 bit 7 bit 0 bit 1 bit 6 bit 7 data read from scrdr and rdrf fla g cleared to 0 by rxi interrupt handler rdrf orer rxi interrupt request rxi interrupt request one frame eri interrupt request by overrun error transfer direction figure 13.13 example of sci receive operation transmitting and receiving seri al data simult aneously (clock synchronous mode): figure 13.14 shows a sample flowchart for transmitting and receiving serial data simultaneously. use the following procedure for serial data tran smission and reception after enabling the sci for transmission and reception.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 578 of 1080 rej09b0230-0300 yes no start of transmission and reception error processin g no yes orer = 1? all data received? read tdre fla g in scssr no yes tdre = 1? write transmit data to sctdr and clear tdre fla g in scssr to 0 no yes rdrf = 1? read orer fla g in scssr read rdrf fla g in scssr [1] sci status check and transmit data write: read scssr and check that the tdre fla g is set to 1, then write transmit data to sctdr and clear the tdre fla g to 0. transition of the tdre fla g from 0 to 1 can also be identified by a txi interrupt. [2] receive error processin g : if a receive error occurs, read the orer fla g in scssr, and after performin g the appropriate error processin g , clear the orer fla g to 0. reception cannot be resumed if the orer fla g is set to 1. [3] sci status check and receive data read: read scssr and check that the rdrf fla g is set to 1, then read the receive data in scrdr and clear the rdrf fla g to 0. transition of the rdrf fla g from 0 to 1 can also be identified by an rxi interrupt. [4] serial transmission/reception continuation procedure: to continue serial transmission/reception, before the msb (bit 7) of the current frame is received, finish readin g the rdrf fla g , readin g scrdr, and clearin g the rdrf fla g to 0. also, before the msb (bit 7) of the current frame is transmitted, read 1 from the tdre fla g to confirm that writin g is possible. then write data to sctdr and clear the tdre fla g to 0. checkin g and clearin g of the tdre fla g is automatic when the dtc is activated by a transmit data empty interrupt (txi) request and data is written to sctdr. also, the rdrf fla g is cleared automatically when the dtc is activated by a receive data full interrupt (rxi) request and the scrdr value is read. note: when switchin g from transmit or receive operation to simultaneous transmit and receive operations, first clear the te bit and re bit to 0, then set both these bits to 1 simultaneously. clear te and re bits in scscr to 0 write transmit data to sctdr, and clear tdre fla g in scssr to 0 end of transmission and reception figure 13.14 sample fl owchart for transmitting /receiving serial data
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 579 of 1080 rej09b0230-0300 13.4.4 multiprocessor communication function use of the multiprocessor communication function en ables data transfer to be performed among a number of processors sharing communication lines by means of asynchronous serial communication using the multiprocessor format, in which a multiprocessor bit is added to the transfer data. when multiprocessor communication is carried out, each receiving station is addressed by a unique id code. the serial communication cycle consists of two component cycles: an id transmission cycle which sp ecifies the receiving station, and a data transmission cycle. the multiprocessor bit is used to differentiate between the id transmission cycle and the data transmission cycle. if the multiprocessor bit is 1, the cycle is an id transmission cycle, and if the multiprocessor bit is 0, the cycle is a data transmission cycle. figure 13.15 shows an example of inter-processor communication using the multiprocessor format. the transmitting station first sends the id code of the receiving station with which it wants to perform serial communication as data with a 1 multiprocessor bit added. it then sends transmit data as data with a 0 multiprocessor bit added. the receiving station skips data until data with a 1 multiprocessor bit is sent. when data with a 1 multiprocessor bit is received, the receivi ng station compares that data with its own id. the station whose id matches then receives the da ta sent next. stations whose id does not match continue to skip data until data with a 1 multiprocessor bit is again received. the sci uses the mpie bit in scscr to implement this function. when the mpie bit is set to 1, transfer of receive data from sc rsr to scrdr, error flag detection, and setting the scssr status flags, rdrf, fer, and oer to 1 are inhibited until data with a 1 multiprocessor bit is received. on reception of receive character with a 1 multiprocessor bit, the mpbr bit in scssr is set to 1 and the mpie bit is automatically cleared, thus normal reception is resumed. if the rie bit in scscr is set to 1 at this time, an rxi interrupt is generated. when the multiprocessor format is selected, the parity bit setting is invalid. all other bit settings are the same as those in normal asynchronous mode. the clock used for multiprocessor communication is the same as that in normal asynchronous mode.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 580 of 1080 rej09b0230-0300 transmittin g station receivin g station a (id = 01) receivin g station b (id = 02) receivin g station c (id = 03) receivin g station d (id = 04) serial transmission line serial data id transmission cycle = receivin g station specification data transmission cycle = data transmission to receivin g station specified by id (mpb = 1) (mpb = 0) h'01 h'aa [le g end] mpb: multiprocessor bit figure 13.15 example of communication using multiprocessor format (transmission of data h'aa to receiving station a)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 581 of 1080 rej09b0230-0300 13.4.5 multiprocessor serial data transmission figure 13.16 shows a sample flowchart for multiprocessor serial data transmission. for an id transmission cycle, set the mpbt bit in scssr to 1 before transmission. for a data transmission cycle, clear the mpbt b it in scssr to 0 before transmission. all other sci operations are the same as those in asynchronous mode. no [1] yes initialization start transmission read tdre fla g in scssr [2] no yes no yes read tend fla g in scssr [3] no yes [4] clear dr to 0 clear te bit in scscr to 0; select the txd pin as an output port with the pfc tdre = 1? all data transmitted? tend = 1? break output? clear tdre fla g to 0 [1] sci initialization: set the txd pin usin g the pfc. after the te bit is set to 1, 1 is output for one frame, and transmission is enabled. however, data is not transmitted. [2] sci status check and transmit data write: read scssr and check that the tdre fla g is set to 1, then write transmit data to sctdr. set the mpbt bit in scssr to 0 or 1. finally, clear the tdre fla g to 0. [3] serial transmission continuation procedure: to continue serial transmission, be sure to read 1 from the tdre fla g to confirm that writin g is possible, then write data to sctdr, and then clear the tdre fla g to 0. checkin g and clearin g of the tdre fla g is automatic when the dtc is activated by a transmit data empty interrupt (txi) request, and data is written to sctdr. [4] break output at the end of serial transmission: to output a break in serial transmission, first clear the port data re g ister (dr) to 0, then clear the te bit to 0 in scscr and use the pfc to select the txd pin as an output port. write transmit data to sctdr and set mpbt bit in scssr figure 13.16 sample multiprocessor serial transmission flowchart
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 582 of 1080 rej09b0230-0300 13.4.6 multiprocessor serial data reception figure 13.18 shows a sample flowchart for multiprocessor serial data reception. if the mpie bit in scscr is set to 1, data is skipped until data with a 1 multiprocessor bit is sent. on receiving data with a 1 multiprocessor bit, the receive data is tr ansferred to scrdr. an rxi interrupt request is generated at this time. all other sci operations are the same as in asynchronous mode. figure 13.17 shows an example of sci operation for multiprocessor format reception. mpie rxd rxd scrdr value 0 d0 d1 d7 1 1 0 d0 d1 d7 01 1 1 data (id1) start bit mpb stop bit start bit data (data1) mpb stop bit data (id2) start bit stop bit start bit data (data2) stop bit rxi interrupt request (multiprocessor interrupt) g enerated idle state (mark state) rdrf scrdr data read and rdrf fla g cleared to 0 in rxi interrupt processin g routine if not this station?s id, mpie bit is set to 1 a g ain rxi interrupt request is not g enerated, and scrdr retains its state id1 (a) data does not match station?s id mpie scrdr value 0 d0 d1 d7 1 1 0 d0 d1 d7 01 1 1 mpb mpb rxi interrupt request (multiprocessor interrupt) g enerated idle state (mark state) rdrf scrdr data read and rdrf fla g cleared to 0 in rxi interrupt processin g routine matches this station?s id, so reception continues, and data is received in rxi interrupt processin g routine mpie bit is set to 1 a g ain id2 (b) data matches station?s id data2 id1 mpie = 0 mpie = 0 figure 13.17 example of sc i operation in reception (example with 8-bit data, multiprocessor bit, one stop bit)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 583 of 1080 rej09b0230-0300 yes [1] no initialization start reception no yes [4] clear re bit in scscr to 0 error processin g (continued on next pa g e) [5] no yes fer = 1? or orer = 1? rdrf = 1? all data received? set mpie bit in scscr to 1 [2] read orer and fer fla g s in scssr read rdrf fla g in scssr [3] read receive data in scrdr no yes this station?s id? read orer and fer fla g s in scssr yes no read rdrf fla g in scssr no yes fer = 1? or orer = 1? read receive data in scrdr rdrf = 1? [1] sci initialization: set the rxd pin usin g the pfc. [2] id reception cycle: set the mpie bit in scscr to 1. [3] sci status check, id reception and comparison: read scssr and check that the rdrf fla g is set to 1, then read the receive data in scrdr and compare it with this station?s id. if the data is not this station?s id, set the mpie bit to 1 a g ain, and clear the rdrf fla g to 0. if the data is this station?s id, clear the rdrf fla g to 0. [4] sci status check and data reception: read scssr and check that the rdrf fla g is set to 1, then read the data in scrdr. [5] receive error processin g and break detection: if a receive error occurs, read the orer and fer fla g s in scssr to identify the error. after performin g the appropriate error processin g , ensure that the orer and fer fla g s are all cleared to 0. reception cannot be resumed if either of these fla g s is set to 1. in the case of a framin g error, a break can be detected by readin g the rxd pin value. figure 13.18 sample multiprocesso r serial reception flowchart (1)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 584 of 1080 rej09b0230-0300 error processin g yes no clear orer and fer fla g s in scssr to 0 no yes no yes framin g error processin g overrun error processin g orer = 1 fer = 1 break? clear re bit in scscr to 0 [5] figure 13.18 sample multiprocesso r serial reception flowchart (2)
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 585 of 1080 rej09b0230-0300 13.5 sci interrupt sources and dtc the sci has four interrupt sources: transmit end (tei), receive error (eri), receive-data-full (rxi), and transmit-data-empty (txi) interrupt requests. table 13.17 shows the interrupt sources. the interrupt sources are enabled or disabled by means of the tie, rie, and teie bits in scscr and the eio bit in scsptr. a separate interrupt request is sent to the interrupt controller fo r each of these interrupt sources. when the tdre flag in the serial status regist er (scssr) is set to 1, a tdr empty interrupt request is generated. this request can be used to activate the data transfer controller (dtc) to transfer data. the tdre flag is automatically cleared to 0 when data is written to the transmit data register (sctdr) through the dtc. when the rdrf flag in scssr is set to 1, an rdr full interrupt request is generated. this request can be used to activate the dtc to transfer data. the rdrf flag is automatically cleared to 0 when data is read from the receive data register (scrdr) through the dtc. when the orer, fer, or per flag in scssr is se t to 1, an eri interrupt request is generated. this request cannot be used to activate the dtc. when processing the received data through the dtc and handling the receive error by an interrupt requested to the cpu, set the rie bit to 1 and set the eio bit in scsptr to 1 to issue an interrupt to the cpu only when a receive error is detected. if the eio bit is cleared to 0, an interrupt is issued to the cpu ev en when correct data is received. when the tend flag in scssr is set to 1, a tei interrupt request is generated. this request cannot be used to activate the dtc. the txi interrupt indicates that transmit data can be written, and the tei interrupt indicates that transmission has been completed. table 13.17 sci interrupt sources interrupt source description dtc activation eri interrupt caused by receive error (orer, fer, or per) not possible rxi interrupt caused by receive data full (rdrf) possible txi interrupt caused by transmit data empty (tdre) possible tei interrupt caused by transmit end (tent) not possible
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 586 of 1080 rej09b0230-0300 13.6 serial port register (s csptr) and sci pins the relationship between scsptr and the sci pins is shown in figures 13.19 and 13.20. sptrw: scsptr write note: * these si g nals control the sck pin accordin g to the settin g s of the c/ a bit in scsmr and bits cke1 and cke0 in scscr. reset internal data bus clock output enable si g nal * serial clock output si g nal * serial clock input si g nal * serial input enable si g nal * bit 3 bit 2 reset qd r sckio sck c qd r sckdt sptrw sptrw c [le g end] figure 13.19 sckio bit, sckdt bit, and sck pin
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 587 of 1080 rej09b0230-0300 [le g end] sptrw: scsptr write reset internal data bus transmit enable si g nal bit 1 bit 0 reset serial transmit data qd r spbio txd c qd r spbdt sptrw sptrw c figure 13.20 spbio bit, spbdt bit, and txd pin
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 588 of 1080 rej09b0230-0300 13.7 usage notes 13.7.1 sctdr writing and tdre flag the tdre flag in the serial stat us register (scssr) is a status flag indicating transferring of transmit data from sctdr into sctsr. the sci sets the tdre flag to 1 when it transfers data from sctdr to sctsr. data can be written to sctdr regardless of the tdre bit status. if new data is written in sctdr when tdre is 0, however, the old data stored in sctdr will be lost because the data has not yet been transfer red to sctsr. before writing transmit data to sctdr, be sure to check that the tdre flag is set to 1. 13.7.2 multiple receive error occurrence if multiple receive errors occur at the same time, the status flags in scssr are set as shown in table 13.18. when an overrun error occurs, data is not transferred from the receive shift register (scrsr) to the receive data register (scrdr) and the received data will be lost. table 13.18 scssr status flag values and transfer of received data scssr status flags receive errors generated rdrf orer fer per receive data transfer from scrsr to scrdr overrun error 1 1 0 0 not transferred framing error 0 0 1 0 transferred parity error 0 0 0 1 transferred overrun error + framing error 1 1 1 0 not transferred overrun error + parity error 1 1 0 1 not transferred framing error + parity error 0 0 1 1 transferred overrun error + framing error + parity error 1 1 1 1 not transferred
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 589 of 1080 rej09b0230-0300 13.7.3 break detection and processing break signals can be detected by reading the r xd pin directly when a framing error (fer) is detected. in the break state the input from the rxd pin consists of all 0s, so the fer flag is set and the parity error flag (per) may also be set. note that, although transfer of receive data to scrdr is halted in the break state, the sci receiver continues to operate. 13.7.4 sending a break signal the i/o condition and level of the txd pin are determined by the spb0io and spb0dt bits in the serial port register (scsptr). this feature can be used to send a break signal. until te bit is set to 1 (enabling transmission) after initializing, txd pin does not work. during the period, mark status is performed by spb0dt bit. therefore, the spb0io and spb0dt bits should be set to 1 (high level output). to send a break signal during serial transmission, clear the spb0dt bit to 0 (low level), then clear the te bit to 0 (halting transmission). when the te bit is cleared to 0, the transmitter is initialized regardless of the current transmission state, and 0 is output from the txd pin. 13.7.5 receive data sampling ti ming and receive margin (asynchronous mode) the sci operates on a base clock with a frequency of 16 times the transfer rate in asynchronous mode. in reception, the sci synchron izes internally with the fall of the start bit, which it samples on the base clock. receive data is latched at th e rising edge of the eighth base clock pulse. the timing is shown in figure 13.21.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 590 of 1080 rej09b0230-0300 0 1 2 3 4 5 6 7 8 9 10 1112 1314 15 0 1 2 3 4 5 6 7 8 9 10 1112 1314 15 0 1 2 3 4 5 d0 d1 16 clocks 8 clocks base clock receive data (rxd) start bit ?7.5 clocks +7.5 clocks synchronization samplin g timin g data samplin g timin g figure 13.21 receive data samplin g timing in asynchronous mode the receive margin in asynchronous mode can therefore be expressed as shown in equation 1. equation 1: m = (0.5 - ) - (l - 0.5) f - (1+f) 100 % 1 2n d - 0.5 n where: m: receive margin (%) n: ratio of bit rate to clock (n = 16) d: clock duty (d = 0 to 1.0) l: frame length (l = 9 to 12) f: absolute deviation of clock frequency from equation 1, if f = 0 and d = 0.5, the recei ve margin is 46.875%, as given by equation 2. equation 2: when d = 0.5 and f = 0: m = (0.5 ? 1/(2 16)) 100 % = 46.875 % this is a theoretical value. a reasonable margin to allow in system designs is 20% to 30%.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 591 of 1080 rej09b0230-0300 13.7.6 note on using dtc when the external clock source is used for the clock for synchronization, input the external clock after waiting for five or more cycles of the peripheral operating clock after sctdr is modified through the dtc. if a transmit clock is input within four cycles after sctdr is modified, a malfunction may occur (figure 13.22). sck tdre txd d0 d2 d6 d1 d3 d4 d5 d7 t note: when usin g the external clock, t must be set to lar g er than 4 cycles. figure 13.22 example of clock synchronous transfer using dtc when data is written to sctdr by activating the dtc by a txi interrupt, the tend flag value becomes undefined. in this case, do not us e the tend flag as th e transmit end flag. 13.7.7 note on using external clock in clock synchronous mode te and re must be set to 1 after waiting for four or more cycles of the peripheral operating clock after the sck external clock is changed from 0 to 1. te and re must be set to 1 only while the sck external clock is 1. 13.7.8 module standby mode setting sci operation can be disabled or enabled using the standby contro l register. the initial setting is for sci operation to be halted. register access is enabled by clearing module standby mode. for details, refer to section 22, power-down modes.
section 13 serial communication interface (sci) rev. 3.00 oct. 06, 2008 page 592 of 1080 rej09b0230-0300
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 593 of 1080 rej09b0230-0300 section 14 synchronous serial communication unit this lsi has an independent synchronous serial communication unit channel. the synchronous serial communication unit has master mode in which this lsi outputs clocks as a master device for synchronous serial communication and slave mode in which clocks are input from an external device for synchronous serial communication. synchronous serial communication can be performed with devices having different clock polarity and clock phase. 14.1 features ? choice of synchronous serial communication mode and clock synchronous mode ? choice of master mode and slave mode ? choice of standard mode and bidirectional mode ? synchronous serial communication with devices with different clock polarity and clock phase ? choice of 8/16/32-bit width of transmit/receive data ? full-duplex communication capability the shift register is incorp orated, enabling transmission a nd reception to be executed simultaneously. ? consecutive serial communication ? choice of lsb-first or msb-first transfer ? choice of a clock source p /4, p /8, p /16, p /32, p /64, p /128, p /256, or an external clock ? five interrupt sources transmit end, transmit data register empty, recei ve data full, overrun error, and conflict error. the data transfer controller (dtc) can be activated by a transmit data register empty request or a receive data full request to transfer data. ? module standby mode can be set
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 594 of 1080 rej09b0230-0300 figure 14.1 shows a block diagram of the synchronous serial communication unit. sso ssck (external clock) module data bus sscrh sscei sstrsr selector ssrxi sscrl sscr2 ssmr sser sssr control circuit clock p p /4 p /8 p /16 p /32 p /64 p /128 p /256 clock selector internal data bus bus interface scs ssi shiftout shiftin ssoei sstxi sstei [le g end] sscrh: sscrl: sscr2: ssmr: sser: sssr: sstdr0 to sstdr3: ssrdr0 to ssrdr3: sstrsr: ss control re g ister h ss control re g ister l ss control re g ister 2 ss mode re g ister ss enable re g ister ss status re g ister ss transmit data re g isters 0 to 3 ss receive data re g isters 0 to 3 ss shift re g ister ssrdr 0 ssrdr 1 ssrdr 2 ssrdr 3 sstdr 0 sstdr 1 sstdr 2 sstdr 3 figure 14.1 block diagram of synchronous serial communication unit
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 595 of 1080 rej09b0230-0300 14.2 input/output pins table 14.1 shows the synchronous serial communication unit pin configuration. table 14.1 pin configuration symbol i/o function ssck i/o synchronous serial communication unit clock input/output ssi i/o synchronous serial communication unit data input/output sso i/o synchronous serial communication unit data input/output scs i/o synchronous serial communication unit chip select input/output
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 596 of 1080 rej09b0230-0300 14.3 register descriptions the synchronous serial communication unit has the following registers. for details on the addresses of these registers and the states of th ese registers in each processing state, see section 24, list of registers. table 14.2 register configuration register name abbrevia- tion r/w initial value address access size ss control register h sscrh r/w h'0d h'ffffcd00 8, 16 ss control register l sscrl r/w h'00 h'ffffcd01 8 ss mode register ssmr r/w h'00 h'ffffcd02 8, 16 ss enable register sser r/w h'00 h'ffffcd03 8 ss status register sssr r/w h'04 h'ffffcd04 8, 16 ss control register 2 sscr2 r/w h'00 h'ffffcd05 8 ss transmit data register 0 sstdr0 r/w h'00 h'ffffcd06 8, 16 ss transmit data register 1 sstdr1 r/w h'00 h'ffffcd07 8 ss transmit data register 2 sstdr2 r/w h'00 h'ffffcd08 8, 16 ss transmit data register 3 sstdr3 r/w h'00 h'ffffcd09 8 ss receive data register 0 ssrdr0 r h'00 h'ffffcd0a 8, 16 ss receive data register 1 ssrdr1 r h'00 h'ffffcd0b 8 ss receive data register 2 ssrdr2 r h'00 h'ffffcd0c 8, 16 ss receive data register 3 ssrdr3 r h'00 h'ffffcd0d 8
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 597 of 1080 rej09b0230-0300 14.3.1 ss control register h (sscrh) sscrh specifies master/slave device selection, bidirectional mode enable, sso pin output value selection, ssck pin selection, and scs pin selection. bit: initial value: r/w: 7654321 0 00001101 r/w r/w r r/w r/w r r/w r/w mss bide - sol solp - css[1:0] bit bit name initial value r/w description 7 mss 0 r/w master/slave device select selects that this module is used in master mode or slave mode. when master mode is selected, transfer clocks are output from the ssck pin. when the ce bit in sssr is set, this bit is automatically cleared. 0: slave mode is selected. 1: master mode is selected. 6 bide 0 r/w bidirectional mode enable selects that both serial data input pin and output pin are used or one of them is used. however, transmission and reception are not performed simultaneously when bidirectional mode is selected. for details, section 14.4.3, relationship between data input/output pins and shift register. 0: standard mode (two pins are used for data input and output) 1: bidirectional mode (one pin is used for data input and output) 5 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 598 of 1080 rej09b0230-0300 bit bit name initial value r/w description 4 sol 0 r/w serial data output value select the serial data output retains its level of the last bit after completion of transmission. the output level before or after transmission can be specified by setting this bit. when specifying the output level, use the mov instruction after clearing the solp bit to 0. since writing to this bit during data transmission causes malfunctions, this bit should not be changed. 0: serial data output is changed to low. 1: serial data output is changed to high. 3 solp 1 r/w sol bit write protect when changing the output level of serial data, set the sol bit to 1 or clear the sol bit to 0 after clearing the solp bit to 0 using the mov instruction. 0: output level can be changed by the sol bit 1: output level cannot be changed by the sol bit. this bit is always read as 1. 2 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 1, 0 css[1:0] 01 r/w scs pin select select that the scs pin functions as scs input or output. 00: setting prohibited 01: function as scs input 10: function as scs automatic input/output (function as scs input before and after transfer and output a low level during transfer) 11: function as scs automatic output (outputs a high level before and after transfer and outputs a low level during transfer)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 599 of 1080 rej09b0230-0300 14.3.2 ss control register l (sscrl) sscrl selects operating mode, software re set, and transmit/receive data length. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r r r r/w r/w fclrm ssums sres - - - dats[1:0] bit bit name initial value r/w description 7 fclrm 0 r/w flag clear mode selects whether the ssrxi and sstxi interrupt flags are cleared on writing to sstdr or reading from ssrdr or on completion of dtc transfer. when using the dtc, set this bit to 0. 0: flags are cleared when dtc transfer is completed 1: flags are cleared when the register is accessed 6 ssums 0 r/w selects transfer mode from synchronous serial communication mode and clock synchronous mode. 0: synchronous serial communication mode 1: clock synchronous mode 5 sres 0 r/w software reset setting this bit to 1 forcibly resets the synchronous serial communication unit internal sequencer. after that, this bit is automatically cleared. the orer, tend, tdre, rdrf, and ce bits in sssr and the te and re bits in sser are also initialized. values of other bits for synchronous serial communication unit registers are held. to stop transfer, set this bit to 1 to reset the synchronous serial communication unit internal sequencer. 4 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 600 of 1080 rej09b0230-0300 bit bit name initial value r/w description 1, 0 dats[1:0] 00 r/w transmit/receive data length select select serial data length. 00: 8 bits 01: 16 bits 10: 32 bits 11: setting prohibited 14.3.3 ss mode register (ssmr) ssmr selects the msb first/lsb first, clock polarity, clock phase, and clock rate of synchronous serial communication. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r r r/w r/w r/w mls cpos cphs - - cks[2:0] bit bit name initial value r/w description 7 mls 0 r/w msb first/lsb first select selects that the serial data is transmitted in msb first or lsb first. 0: lsb first 1: msb first 6 cpos 0 r/w clock polarity select selects the ssck clock polarity. 0: high output in idle mode, and low output in active mode 1: low output in idle mode, and high output in active mode 5 cphs 0 r/w clock phase select (only for synchronous serial communication mode) selects the ssck clock phase. 0: data changes at the first edge. 1: data is latched at the first edge.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 601 of 1080 rej09b0230-0300 bit bit name initial value r/w description 4, 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 to 0 cks[2:0] 000 r/w transfer clock rate select select the transfer clock rate (prescaler division rate) when an internal clock is selected. 000: reserved 001: p /4 010: p /8 011: p /16 100: p /32 101: p /64 110: p /128 111: p /256
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 602 of 1080 rej09b0230-0300 14.3.4 ss enable register (sser) sser performs transfer/receive control of sync hronous serial communication and setting of interrupt enable. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r r r/w r/w r/w r/w te re - - teie tie rie ceie bit bit name initial value r/w description 7 te 0 r/w transmit enable when this bit is set to 1, transmission is enabled. 6 re 0 r/w receive enable when this bit is set to 1, reception is enabled. 5, 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 teie 0 r/w transmit end interrupt enable when this bit is set to 1, a sstei interrupt request is enabled. 2 tie 0 r/w transmit interrupt enable when this bit is set to 1, a sstxi interrupt request is enabled. 1 rie 0 r/w receive interrupt enable when this bit is set to 1, an ssrxi interrupt request and an ssoei interrupt request are enabled. 0 ceie 0 r/w conflict error interrupt enable when this bit is set to 1, a sscei interrupt request is enabled.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 603 of 1080 rej09b0230-0300 14.3.5 ss status register (sssr) sssr is a status flag register for interrupts. bit: initial value: r/w: 7654321 0 00000100 r r/w r r r/w r/w r/w r/w - orer - - tend tdre rdrf ce bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 orer 0 r/w overrun error if the next data is received while rdrf = 1, an overrun error occurs, indicating abnormal termination. ssrdr stores 1-frame receive data before an overrun error occurs and loses data to be received later. while orer = 1, consecutive serial reception cannot be continued. serial transmission cannot be continued, either. [setting condition] ? when one byte of the next reception is completed with rdrf = 1 [clearing condition] ? when writing 0 after reading orer = 1 5, 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 604 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 tend 0 r/w transmit end [setting conditions] ? when the last bit of transmit data is transmitted while the tendsts bit in sscr2 is cleared to 0 and the tdre bit is set to 1 ? after the last bit of transmit data is transmitted while the tendsts bit in sscr2 is set to 1 and the tdre bit is set to 1 [clearing conditions] ? when writing 0 after reading tend = 1 ? when writing data to sstdr 2 tdre 1 r/w transmit data empty indicates whether or not sstdr contains transmit data. [setting conditions] ? when the te bit in sser is 0 ? when data is transferred from sstdr to sstrsr and sstdr is ready to be written to. [clearing conditions] ? when writing 0 after reading tdre = 1 ? when writing data to sstdr with te = 1 ? when the dtc is activated by an sstxi interrupt and transmit data is written to sstdr while the disel bit in mrb of the dtc is 0 1 rdrf 0 r/w receive data register full indicates whether or not ssrdr contains receive data. [setting condition] ? when receive data is transferred from sstrsr to ssrdr after successful serial data reception [clearing conditions] ? when writing 0 after reading rdrf = 1 ? when reading receive data from ssrdr ? when the dtc is activated by an ssrxi interrupt and receive data is read into ssrdr while the disel bit in mrb of the dtc is 0
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 605 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 ce 0 r/w conflict/incomplete error indicates that a conflict error has occurred when 0 is externally input to the scs pin with ssums = 0 (synchronous serial communication mode) and mss = 1 (master mode). if the scs pin level changes to 1 with ssums = 0 (synchronous serial communication mode) and mss = 0 (slave mode), an incomplete error occurs because it is determined that a master device has terminated the transfer. data reception does not continue while the ce bit is set to 1. serial transmission also does not continue. reset the synchronous serial communication unit internal sequencer by setting the sres bit in sscrl to 1 before resuming transfer after incomplete error. [setting conditions] ? when a low level is input to the scs pin in master mode (the mss bit in sscrh is set to 1) ? when the scs pin is changed to 1 during transfer in slave mode (the mss bit in sscrh is cleared to 0) [clearing condition] ? when writing 0 after reading ce = 1
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 606 of 1080 rej09b0230-0300 14.3.6 ss control register 2 (sscr2) sscr2 is a register that selects the assert timing of the scs pin, data output timing of the sso pin, and set timing of the tend bit. bit: initial value: r/w: 7654321 0 00000000 r r r r/w r/w r/w r r --- tendsts scsats ssodts -- bit bit name initial value r/w description 7 to 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 4 tendsts 0 r/w selects the timing of setting the tend bit (valid in synchronous serial communication and master mode). 0: sets the tend bit when the last bit is being transmitted 1: sets the tend bit after the last bit is transmitted 3 scsats 0 r/w selects the assertion timing of the scs pin (valid in synchronous serial communication and master mode). 0: min. values of t lead and t lag are 1/2 t sucyc 1: min. values of t lead and t lag are 3/2 t sucyc 2 ssodts 0 r/w selects the data output timing of the sso pin (valid in synchronous serial communication and master mode) 0: while bide = 0, mss = 1, and te = 1 or while bide = 1, te = 1, and re = 0, the sso pin outputs data 1: while bide = 0, mss = 1, and te = 1 or while bide = 1, te = 1, and re = 0, the sso pin outputs data while the scs pin is driven low 1, 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 607 of 1080 rej09b0230-0300 14.3.7 ss transmit data registers 0 to 3 (sstdr0 to sstdr3) sstdr is an 8-bit register that stores transmit data. when 8-bit data length is selected by bits dats1 and dats0 in sscrl, sstdr0 is valid. when 16-bit data length is selected, sstdr0 and sstdr1 are valid. when 32-bit data length is selected, sstdr0 to sstdr3 are valid. do not access sstdr that is not valid. when the synchronous serial communication unit detects that sstrsr is empty, it transfers the transmit data written in sstdr to sstrsr and starts serial transmission. if the next transmit data has already been written to sstdr during serial transmission, the synchronous serial communication unit performs cons ecutive serial transmission. although sstdr can always be read from or writte n to by the cpu and dtc, to achieve reliable serial transmission, write transmit data to sstdr after confirming that the tdre bit in sssr is set to 1. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w bit bit name initial value r/w description 7 to 0 all 0 r/w serial transmit data table 14.3 setting of dats bits in sscrl and corresponding sstdr dats[1:0] setting 00 01 10 11 (invalid setting) sstdr0 valid valid valid invalid sstdr1 invalid valid valid invalid sstdr2 invalid invalid valid invalid sstdr3 invalid invalid valid invalid
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 608 of 1080 rej09b0230-0300 14.3.8 ss receive data registers 0 to 3 (ssrdr0 to ssrdr3) ssrdr is an 8-bit register that stores receive data. when 8-bit data length is selected by bits dats1 and dats0 in sscrl, ssrdr0 is valid. when 16-bit data length is selected, ssrdr0 and ssrdr1 are valid. when 32-bit data length is selected, ssrdr0 to ssrdr3 are valid. do not access ssrdr that is not valid. when the synchronous serial communication un it has received 1-byte data, it transfers the received serial data from sstrsr to ssrdr wher e it is stored. after this, sstrsr is ready for reception. since sstrsr and ssrdr function as a double buffer in this way, consecutive receive operations can be performed. read ssrdr after confirming that the rdrf bit in sssr is set to 1. ssrdr is a read-only register, therefore, cannot be written to by the cpu. bit: initial value: r/w: 7654321 0 00000000 rrrrrrrr bit bit name initial value r/w description 7 to 0 all 0 r serial receive data table 14.4 setting of dats bit in sscrl and corresponding ssrdr dats[1:0] setting 00 01 10 11 (invalid setting) ssrdr0 valid valid valid invalid ssrdr1 invalid valid valid invalid ssrdr2 invalid invalid valid invalid ssrdr3 invalid invalid valid invalid
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 609 of 1080 rej09b0230-0300 14.3.9 ss shift register (sstrsr) sstrsr is a shift register that transmits and receives serial data. when data is transferred from sstdr to sstrsr, bit 0 of transmit data is bit 0 in the sstdr contents (mls = 0: lsb first communication) and is bit 7 in the sstdr contents (mls = 1: msb first communication). the synchronous serial communication unit transfers data from the lsb (bit 0) in sstrsr to the sso pin to perform serial data transmission. in reception, the synchronous serial communication unit sets serial da ta that has been input via the ssi pin in sstrsr from the lsb (bit 0). when 1-byte data has been received, the sstrsr contents are automatically tr ansferred to ssrdr. sstrsr cannot be directly accessed by the cpu. bit: initial value: r/w: 7654321 0 -------- --------
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 610 of 1080 rej09b0230-0300 14.4 operation 14.4.1 transfer clock a transfer clock can be selected from seven internal clocks and an external clock. before using this module, enable the ssck pin function in the pfc. when the mss bit in sscrh is 1, an internal clock is selected and the ssck pin is used as an output pin. when transfer is started, the clock with the transfer rate set by bits cks2 to cks0 in ssmr is output from the ssck pin. when mss = 0, an external clock is selected and the ssck pin is used as an input pin. 14.4.2 relationship of clock phase, polarity, and data the relationship of clock phase, polarity, and transfer data depends on the combination of the cpos and cphs bits in ssmr when the value of the ssums bit in sscrl is 0. figure 14.2 shows the relationship. when ssums = 1, the cp hs setting is invalid a lthough the cpos setting is valid. setting the mls bit in ssmr selects that msb or lsb first communication. when mls = 0, data is transferred from the lsb to the msb. when mls = 1, data is transferred from the msb to the lsb. ssck (cpos = 0) (1) when cphs = 0 (2) when cphs = 1 ssck (cpos = 1) ssi, sso scs bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 ssck (cpos = 0) ssck (cpos = 1) ssi, sso scs bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 figure 14.2 relationship of clock phase, polarity, and data
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 611 of 1080 rej09b0230-0300 14.4.3 relationship between data input/output pins and shift register the connection between data input/output pins and the ss shift register (sstrsr) depends on the combination of the mss and bide bits in sscrh and the ssums bit in sscrl. figure 14.3 shows the relationship. the synchronous serial communication unit transmits serial data from the sso pin and receives serial data from the ssi pin when operating with bide = 0 and mss = 1 (standard, master mode) (see figure 14.3 (1)). the synchronous serial communication unit transmits serial data from the ssi pin and receives serial data from the sso pin when operating with bide = 0 and mss = 0 (standard, slave mode) (see figure 14.3 (2)). the synchronous serial communication unit transmits and receives serial data from the sso pin regardless of master or slave mode when operating with bide = 1 (bidirectional mode) (see figures 14.3 (3) and (4)). however, even if both the te and re bits are set to 1, transmission and reception are not performed simultaneously. either the te or re bit must be selected. the synchronous serial communication unit transmits serial data from the sso pin and receives serial data from the ssi pin when operating with ssums = 1. the ssck pin outputs the internal clock when mss = 1 and function as an input pin when mss = 0 (see figures 14.3 (5) and (6)).
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 612 of 1080 rej09b0230-0300 ssck shift re g ister (sstrsr) shift re g ister (sstrsr) shift re g ister (sstrsr) shift re g ister (sstrsr) sso ssi ssck sso ssi ssck sso ssi ssck sso ssi (1) when ssums = 0, bide = 0 (standard mode), mss = 1, te = 1, and re = 1 ssck shift re g ister (sstrsr) sso ssi ssck shift re g ister (sstrsr) sso ssi (2) when ssums = 0, bide = 0 (standard mode), mss = 0, te = 1, and re = 1 (4) when ssums = 0, bide = 1 (bidirectional mode), mss = 0, and either te or re = 1 (3) when ssums = 0, bide = 1 (bidirectional mode), mss = 1, and either te or re = 1 (5) when ssums = 1 and mss = 1 (6) when ssums = 1 and mss = 0 figure 14.3 relationship between data input/output pins and the shift register
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 613 of 1080 rej09b0230-0300 14.4.4 communication modes and pin functions the synchronous serial communication unit switches the input/output pin (ssi, sso, ssck, and scs ) functions according to the communication m odes and register setti ngs. the input/output directions of the pins should be selected in the port i/o registers. the relationship of communication modes and input/output pin functions are shown in tables 14.5 to 14.7. table 14.5 communication modes and pin states of ssi and sso pins register setting pin state communication mode ssums bide mss te re ssi sso 0 0 0 0 1 ? input synchronous serial communication mode 1 0 output ? 1 output input 1 0 1 input ? 1 0 ? output 1 input output 0 1 0 0 1 ? input synchronous serial communication mode (bidirectional) 1 0 ? output 1 0 1 ? input 1 0 ? output 1 0 0 0 1 input ? clock synchronous communication mode 1 0 ? output 1 input output 1 0 1 input ? 1 0 ? output 1 input output [legend] ? : not used as synchronous serial communication unit pin
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 614 of 1080 rej09b0230-0300 table 14.6 communication modes and pin states of ssck pin register setting pin state communication mode ssums mss ssck synchronous serial communication mode 0 0 input 1 output clock synchronous communication mode 1 0 input 1 output [legend] ? : not used as synchronous serial communication unit pin table 14.7 communication modes and pin states of scs pin register setting pin state communication mode ssums mss css1 css0 scs 0 0 x x input synchronous serial communication mode 1 0 0 ? 0 1 input 1 0 automatic input/output 1 1 output clock synchronous communication mode 1 x x x ? [legend] x: don't care ? : not used as synchronous serial communication unit pin
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 615 of 1080 rej09b0230-0300 14.4.5 synchronous serial communication mode in synchronous serial communication mode, data communications are performed via four lines: clock line (ssck), data input line (ssi or sso), data output line (ssi or sso), and chip select line ( scs ). in addition, the synchronous serial communicatio n unit supports bidirectional mode in which a single pin functions as data input and data output lines. (1) initial settings in synchronous serial communication mode figure 14.4 shows an example of the initial settings in synchronous serial communication mode. before data transfer, clear both the te and re bits in sser to 0 to set the initial values. note: before changing operating modes and communications formats, clear both the te and re bits to 0. although clearing the te bit to 0 sets the tdre bit to 1, clearing the re bit to 0 does not change the values of the rdrf and orer bits and ssrdr. those bits retain the previous values.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 616 of 1080 rej09b0230-0300 start settin g initial values [1] [2] [3] [4] end set pfc for external pins to be used (ssck, ssi, sso, and scs ) clear ssums in sscrh to 0 and specify bits dats1 and dats0 specify mss, bide, sol, scks, css1, and css0 bits in sscrh specify mls, cpos, cphs, cks2, cks1, and cks0 bits in ssmr specify bits tendsts, scsats, and ssodts in sscr2 clear te and re bits in sser to 0 [1] make appropriate settin g s in the pfc for the external pins to be used. [2] specify master/slave mode selection, bidirectional mode enable, sso pin output value selection, ssck pin selection, and scs pin selection. [3] selects synchronous serial communication mode and specify transmit/receive data len g th. [4] specify msb first/lsb first selection, clock polarity selection, clock phase selection, and transfer clock rate selection. [5] specify timin g of tend bit settin g , scs pin assertion, and data output on the sso pin. [6] enables/disables interrupt requests to the cpu. [5] specify bits te, re, teie, tie, rie, and ceie in sser simultaneously [6] figure 14.4 example of initial settings in synchronous serial communication mode
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 617 of 1080 rej09b0230-0300 (2) data transmission figure 14.5 shows an example of transmission operation, and figure 14.6 shows a flowchart example of data transmission. when transmitting data, the synchronous serial communication unit operates as shown below. in master mode, the synchronous serial communication unit outputs a transfer clock and data. in slave mode, when a low level signal is input to the scs pin and a transfer clock is input to the ssck pin, the synchronous serial communication unit outputs data in synchronization with the transfer clock. writing transmit data to sstdr after the te bit is set to 1 clears the tdre bit in sssr to 0, and the sstdr contents are transfer red to sstrsr. after that, the synchronous serial communication unit sets the tdre bit to 1 and starts transmission. at this time, if the tie bit in sser is set to 1, a txi interrupt is generated. when 1-frame data has been transferred with tdre = 0, the sstdr contents are transferred to sstrsr to start the next frame transmission. when the 8th bit of transmit data has been transferred with tdre = 1, the tend bit in sssr is set to 1 and the state is retained. at this time, if the teie bit is set to 1, a tei interrupt is generated. after transmission, the output level of the ssck pin is fixed high when cpos = 0 and low when cpos = 1. while the orer bit in sssr is set to 1, transm ission is not performed. check that the orer bit is cleared to 0 before transmission.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 618 of 1080 rej09b0230-0300 scs ssck (1) when 8-bit data len g th is selected (sstdr0 is valid) with cpos = 0 and cphs = 0 (2) when 16-bit data len g th is selected (sstdr0 and sstdr1 are valid) with cpos = 0 and cphs = 0 (3) when 32-bit data len g th is selected (sstdr0 to sstdr3 are valid) with cpos = 0 and cphs = 0 bit 0 bit 0 bit 1 bit 1 bit 2 bit 2 bit 3 bit 3 bit 4 bit 4 bit 5 bit 5 bit 6 bit 6 bit 7 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 7 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 to to to to to to to to bit 0 bit 7 bit 7 bit 0 bit 7 bit 0 bit 7 bit 0 bit 7 bit 0 bit 7 bit 0 bit 7 bit 0 bit 7 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 sso tdre tend lsi operation user operation lsi operation user operation lsi operation user operation txi interrupt g enerated tei interrupt g enerated tei interrupt g enerated txi interrupt g enerated data written to sstdr0 data written to sstdr0 and sstdr1 data written to sstdr0 sstdr1 scs ssck tdre tend sso (lsb first) sso (msb first) sso (lsb first) sso (msb first) sstdr0 sstdr0 sstdr1 scs ssck tdre tend sstdr0 sstdr3 sstdr1 sstdr2 sstdr2 sstdr1 sstdr 3 sstdr0 1 frame 1 frame 1 frame sstdr0 (lsb first transmission) sstdr0 (msb first transmission) 1 frame txi interrupt g enerated tei interrupt g enerated data written to sstdr0 to sstdr3 txi interrupt g enerated tei interrupt g enerated figure 14.5 example of transmission operation (synchronous serial communication mode)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 619 of 1080 rej09b0230-0300 yes start [1] [2] [3] [1] initial setting: specify the transmit data format. [2] check that the synchronous serial communication unit state and write transmit data: write transmit data to sstdr after reading and confirming that the tdre bit is 1. the tdre bit is automatically cleared to 0 and transmission is started by writing data to sstdr. [3] procedure for consecutive data transmission: to continue data transmission, confirm that the tdre bit is 1 meaning that sstdr is ready to be written to. after that, data can be written to sstdr. the tdre bit is automatically cleared to 0 by writing data to sstdr. [4] procedure for data transmission end: to end data transmission, confirm that the tend bit is cleared to 0. after completion of transmitting the last bit, clear the te bit to 0. note: hatching boxes represent synchronous serial communication unit internal operations. initial setting read tdre in sssr tdre = 1? yes yes no no no write transmit data to sstdr tdre automatically cleared data transferred from sstdr to sstrsr set tdre to 1 to start transmission consecutive data transmission? read tend in sssr tend = 1? clear tend to 0 clear te in sser to 0 end transmission yes no confirm that tend is cleared to 0 one bit time quantum elapsed? [4] figure 14.6 flowchart example of data transmission (synchronous serial communication mode)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 620 of 1080 rej09b0230-0300 (3) data reception figure 14.7 shows an example of reception operati on, and figure 14.8 shows a flowchart example of data reception. when receiving data, the s ynchronous serial communication unit operates as shown below. after setting the re bit to 1 and dummy-reading ssrdr, the synchronous serial communication unit starts data reception. in master mode, the synchronous serial communi cation unit outputs a transf er clock and receives data. in slave mode, when a low level signal is input to the scs pin and a transfer clock is input to the ssck pin, the synchronous serial communication unit receives data in synchronization with the transfer clock. when 1-frame data has been received, the rdrf b it in sssr is set to 1 and the receive data is stored in ssrdr. at this time, if the rie bit in sser is set to 1, an rxi interrupt is generated. the rdrf bit is automatically cleared to 0 by reading ssrdr. when the rdrf bit has been set to 1 at the 8th rising edge of the transfer clock, the orer bit in sssr is set to 1. this indicates that an overrun error (oei) has occurred. at this time, data reception is stopped. while the orer bit in sssr is set to 1, reception is not performed. to resume the reception, clear the orer bit to 0.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 621 of 1080 rej09b0230-0300 scs ssck (1) when 8-bit data len g th is selected (ssrdr0 is valid) with cpos = 0 and cphs = 0 (2) when 16-bit data len g th is selected (ssrdr0 and ssrdr1 are valid) with cpos = 0 and cphs = 0 (3) when 32-bit data len g th is selected (ssrdr0 to ssrdr3 are valid) with cpos = 0 and cphs = 0 ssi rdrf ssrdr1 scs ssck rdrf ssrdr0 ssrdr0 ssrdr1 scs ssck rdrf ssrdr0 ssrdr3 ssrdr1 ssrdr2 ssrdr2 ssrdr1 ssrdr3 ssrdr0 1 frame 1 frame 1 frame 1 frame bit 0 bit 0 bit 1 bit 1 bit 2 bit 2 bit 3 bit 3 bit 4 bit 4 bit 5 bit 5 bit 6 bit 6 bit 7 bit 7 lsi operation dummy-read ssrdr0 dummy-readssrdr0 read ssrdr0 user operation lsi operation user operation lsi operation user operation ssrdr0 (lsb first transmission) ssrdr0 (msb first transmission) rxi interrupt g enerated rxi interrupt g enerated rxi interrupt g enerated bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 ssi (lsb first) ssi (msb first) bit 0 to to to to to to to to bit 0 bit 7 bit 7 bit 0 bit 7 bit 0 bit 7 bit 0 bit 7 bit 0 bit 7 bit 0 bit 7 bit 0 bit 7 ssi (lsb first) ssi (msb first) dummy-readssrdr0 rxi interrupt g enerated figure 14.7 example of reception operation (synchronous serial communication mode)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 622 of 1080 rej09b0230-0300 yes [1] [2] [3] [4] [5] [6] [1] initial setting: specify the receive data format. [2] start reception: when ssrdr is dummy-read with re = 1, reception is started. [3], [6] receive error processing: when a receive error occurs, execute the designated error processing after reading the orer bit in sssr. after that, clear the orer bit to 0. while the orer bit is set to 1, transmission or reception is not resumed. [4] to continue single reception: when continuing single reception, wait for time of t sucyc while the rdrf flag is set to 1 and then read receive data in ssrdr. the next single reception starts after reading receive data in ssrdr. [5] to complete reception: to complete reception, read receive data after clearing the re bit to 0. when reading ssrdr without clearing the re bit, reception is resumed. no yes yes no start initial setting dummy-read ssrdr read sssr rdrf = 1? orer = 1? consecutive data reception? read received data in ssrdr rdrf automatically cleared re = 0 read receive data in ssrdr end reception overrun error processing clear orer in sssr end reception note: hatching boxes represent synchronous serial communication unit internal operations. no figure 14.8 flowchart exampl e of data reception (synchronous seri al communication mode) (4) data transmission/reception figure 14.9 shows a flowchart example of si multaneous transmission/reception. the data transmission/reception is performed combining the data transmission and data reception as mentioned above. the data tran smission/reception is started by writing transmit data to sstdr with te = re = 1.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 623 of 1080 rej09b0230-0300 before switching transmission mode (te = 1) or reception mode (re = 1) to transmission/reception mode (te = re = 1), clear the te and re bits to 0. when starting the transfer, confirm that the tend, rdrf, and orer bits are cleared to 0 before setting the te or re bit to 1. yes start initial setting [1] [2] [1] initial setting: specify the transmit/receive data format. [2] check the synchronous serial communication unit state and write transmit data: write transmit data to sstdr after reading and confirming that the tdre bit in sssr is 1. the tdre bit is automatically cleared to 0 and transmission/ reception is started by writing data to sstdr. [3] check the synchronous serial communication unit state: read sssr confirming that the rdrf bit is 1. a change of the rdrf bit (from 0 to 1) can be notified by rxi interrupt. [4] receive error processing: when a receive error occurs, execute the designated error processing after reading the orer bit in sssr. after that, clear the orer bit to 0. while the orer bit is set to 1, transmission or reception is not resumed. [5] procedure for consecutive data transmission/reception: to continue serial data transmission/reception, confirm that the tdre bit is 1 meaning that sstdr is ready to be written to. after that, data can be written to sstdr. the tdre bit is automatically cleared to 0 by writing data to sstdr. [4] [5] [3] read tdre in sssr. tdre = 1? yes yes yes yes no no no no write transmit data to sstdr tdre automatically cleared data transferred from sstdr to sstrsr tdre set to 1 to start transmission read sssr rdrf = 1? orer = 1? tend = 1? read receive data in ssrdr rdrf automatically cleared consecutive data transmission/reception? no yes one-bit interval elapsed? no read the tend bit in sssr clear tend in sssr to 0 clear te and re in sser to 0 error processing end transmission/reception note: hatching boxes represent synchronous serial communication unit internal operations. figure 14.9 flowchart exampl e of simultaneous transmis sion/reception (synchronous serial communication mode)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 624 of 1080 rej09b0230-0300 14.4.6 scs pin control and conflict error when bits css1 and css0 in sscrh are set to b'10 and the ssums bit in sscrl is cleared to 0, the scs pin becomes an input pin (hi-z) before the se rial transfer is started and after the serial transfer is complete. because of this, the synchronous serial communication unit performs conflict error detection during these periods. if a low level signal is input to the scs pin during these periods, it is detected as a conflict error. at this time, the ce bit in sssr is set to 1 and the mss bit is cleared to 0. note: while the ce bit is set to 1, transmission or reception can not be restarted. clear the ce bit to 0 before restarting the transmission or reception. ce data written to sstdr conflict error detection period worst time for internal clockin g of scs mss internal si g nal for transfer enable scs output external input to scs internally-clocked scs (hi-z) figure 14.10 conflict error det ection timing (before transfer)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 625 of 1080 rej09b0230-0300 p scs mss ce (hi-z) transfer end conflict error detection period internal si g nal for transfer enable figure 14.11 conflict error det ection timing (after transfer end)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 626 of 1080 rej09b0230-0300 14.4.7 clock synchronous communication mode in clock synchronous communication mode, data communications are performed via three lines: clock line (ssck), data input line (ssi), and data output line (sso). (1) initial settings in clock synchronous communication mode figure 14.12 shows an example of the initial settings in clock synchronous communication mode. before data transfer, clear both the te and re bits in sser to 0 to set the initial values. note: before changing operating modes and communications formats, clear both the te and re bits to 0. although clearing the te bit to 0 sets the tdre bit to 1, clearing the re bit to 0 does not change the values of the rdrf and orer bits and ssrdr. those bits retain the previous values. start settin g initial values [1] [2] [3] [4] set pfc for external pins to be used (ssck, ssi, sso, and scs ) set ssums in sscrl to 1 and specify bits dats1 and dats0 specify mss bit in sscrh specify bits cpos, cks2, cks1, and cks0 in ssmr clear te and re bits in sser to 0 [1] make appropriate settin g s in the pfc for the external pins to be used. [2] specify master/slave mode selection and ssck pin selection. [3] selects clock synchronous communication mode and specify transmit/receive data len g th. [4] specify clock polarity selection and transfer clock rate selection. [5] specify timin g of tend bit settin g , scs pin assertion, and data output on the sso pin. [6] enables/disables interrupt requests to the cpu. end specify bits tendsts, scsats, and ssodts in sscr2 [5] specify bits te, re, teie, tie, rie, and ceie in sser simultaneously [6] figure 14.12 example of initial settings in clock synchronous communication mode
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 627 of 1080 rej09b0230-0300 (2) data transmission figure 14.13 shows an example of transmission operation, and figure 14.14 shows a flowchart example of data transmission. when transmitting data in clock synchronous communication mode, the synchronous serial communication unit operates as shown below. in master mode, the synchronous serial communication unit outputs a transfer clock and data. in slave mode, when a transfer clock is input to the ssck pin, the synchronous serial communication unit outputs data in synchronization with the transfer clock. writing transmit data to sstdr after the te bit is set to 1 clears the tdre bit in sssr to 0, and the sstdr contents are transfer red to sstrsr. after that, the synchronous serial communication unit sets the tdre bit to 1 and starts transmission. at this time, if the tie bit in sser is set to 1, a txi interrupt is generated. when 1-frame data has been transferred with tdre = 0, the sstdr contents are transferred to sstrsr to start the next frame transmission. when the 8th bit of transmit data has been transferred with tdre = 1, the tend bit in sssr is set to 1 and the state is retained. at this time, if the teie bit is set to 1, a tei interrupt is generated. while the orer bit in sssr is set to 1, transm ission is not performed. check that the orer bit is cleared to 0 before transmission. lsi operation user operation sso ssck tdre tend data written to sstdr txi interrupt g enerated tei interrupt g enerated txi interrupt g enerated data written to sstdr bit 0 bit 1 bit 7 bit 0 bit 1 bit 7 1 frame 1 frame figure 14.13 example of transmission operation (clock synchronous communication mode)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 628 of 1080 rej09b0230-0300 yes start [1] [2] [3] [1] initial setting: specify the transmit data format. [2] check that the synchronous serial communication unit state and write transmit data: write transmit data to sstdr after reading and confirming that the tdre bit is 1. the tdre bit is automatically cleared to 0 and transmission is started by writing data to sstdr. [3] procedure for consecutive data transmission: to continue data transmission, confirm that the tdre bit is 1 meaning that sstdr is ready to be written to. after that, data can be written to sstdr. the tdre bit is automatically cleared to 0 by writing data to sstdr. [4] procedure for data transmission end: to end data transmission, confirm that the tend bit is cleared to 0. after completion of transmitting the last bit, clear the te bit to 0. note: hatched boxes represent synchronous serial communication unit internal operations. initial setting read tdre in sssr tdre = 1? yes yes no no no write transmit data to sstdr tdre automatically cleared data transferred from sstdr to sstrsr set tdre to 1 to start transmission consecutive data transmission? read tend in sssr tend = 1? clear te in sser to 0 end transmission yes no confirm that tend is cleared to 0 one-bit intreval elapsed? clear tend to 0 [4] figure 14.14 flowchart example of transmission operation (clock synchronous communication mode)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 629 of 1080 rej09b0230-0300 (3) data reception figure 14.15 shows an example of reception oper ation, and figure 14.16 shows a flowchart example of data reception. when receiving data, the synchronous se rial communication unit operates as shown below. after setting the re bit in sser to 1, the synchronous serial communication unit starts data reception. in master mode, the synchronous serial communi cation unit outputs a transf er clock and receives data. in slave mode, when a transfer clock is input to the ssck pin, the synchronous serial communication unit receives data in sync hronization with the transfer clock. when 1-frame data has been received, the rdrf b it in sssr is set to 1 and the receive data is stored in ssrdr. at this time, if the rie bit is se t to 1, an rxi interrupt is generated. the rdrf bit is automatically cleared to 0 by reading ssrdr. when the rdrf bit has been set to 1 at the 8th rising edge of the transfer clock, the orer bit in sssr is set to 1. this indicates that an overrun error (oei) has occurred. at this time, data reception is stopped. while the orer bit in sssr is set to 1, reception is not performed. to resume the reception, clear the orer bit to 0. lsi operation user operation sso ssck rdrf dummy-read ssrdr rxi interrupt g enerated rxi interrupt g enerated rxi interrupt g enerated read data from ssrdr read data from ssrdr bit 0 bit 7 bit 0 bit 0 bit 7 bit 7 1 frame 1 frame figure 14.15 example of reception operation (clock synchronous communication mode)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 630 of 1080 rej09b0230-0300 yes [1] [2] [3] [4] [5] [1] initial setting: specify the receive data format. [2] start reception: when the re bit is set to 1, reception is started. [3], [5] receive error processing: when a receive error occurs, execute the designated error processing after reading the orer bit in sssr. after that, clear the orer bit to 0. while the orer bit is set to 1, transmission or reception is not resumed. [4] to complete reception: to complete reception, read receive data after clearing the re bit to 0. when reading ssrdr without clearing the re bit, reception is resumed. no yes yes no start initial setting re = 1 (reception started) read sssr rdrf = 1? orer = 1? consecutive data reception? read received data in ssrdr rdrf automatically cleared re = 0 read receive data in ssrdr end reception overrun error processing clear orer in sssr end reception note: hatching boxes represent synchronous serial communication unit internal operations. no figure 14.16 flowchart e xample of data reception (clock synchronous communication mode) (4) data transmission/reception figure 14.17 shows a flowchart example of si multaneous transmission/reception. the data transmission/reception is performed combining the data transmission and data reception as mentioned above. the data tran smission/reception is started by writing transmit data to sstdr with te = re = 1.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 631 of 1080 rej09b0230-0300 before switching transmission mode (te = 1) or reception mode (re = 1) to transmission/reception mode (te = re = 1), clear the te and re bits to 0. when starting the transfer, confirm that the tend, rdrf, and orer bits are cleared to 0 before setting the te or re bits to 1. yes start initial setting [1] [2] [1] initial setting: specify the transmit/receive data format. [2] check the synchronous serial communication unit state and write transmit data: write transmit data to sstdr after reading and confirming that the tdre bit in sssr is 1. the tdre bit is automatically cleared to 0 and transmission is started by writing data to sstdr. [3] check the synchronous serial communication unit state: read sssr confirming that the rdrf bit is 1. a change of the rdrf bit (from 0 to 1) can be notified by rxi interrupt. [4] receive error processing: when a receive error occurs, execute the designated error processing after reading the orer bit in sssr. after that, clear the orer bit to 0. while the orer bit is set to 1, transmission or reception is not resumed. [5] procedure for consecutive data transmission/reception: to continue serial data transmission/reception, confirm that the tdre bit is 1 meaning that sstdr is ready to be written to. after that, data can be written to sstdr. the tdre bit is automatically cleared to 0 by writing data to sstdr. [4] [5] [3] read tdre in sssr. tdre = 1? yes yes yes no no no write transmit data to sstdr tdre automatically cleared data transferred from sstdr to sstrsr tdre set to 1 to start transmission read sssr rdrf = 1? orer = 1? read receive data in ssrdr rdrf automatically cleared consecutive data transmission/reception? clear tend in sssr to 0 clear te and re in sser to 0 error processing end transmission/reception note: hatching boxes represent synchronous serial communication unit internal operations. yes tend = 1? no yes one-bit interval elapsed? no read the tend bit in sssr no figure 14.17 flowchart example of simultaneous transmission/reception (clock synchronous communication mode)
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 632 of 1080 rej09b0230-0300 14.5 synchronous serial communication unit interrupt sources and dtc the synchronous serial communication unit interrupt requests are an overrun error, a conflict error, a receive data register full, transmit data register empty, and a transmit end interrupts. of these interrupt sources, a receive data register fu ll, and a transmit data register empty can activate the dtc for data transfer. since both an overrun error and a conflict error in terrupts are allocated to the sseri vector address, and both a transmit data register empty and a transmit end interrupt s are allocated to the sstxi vector address, the interrupt source should be decided by their flags. table 14.8 lists the interrupt sources. when an interrupt condition shown in table 14.8 is satisfied, an interrupt is requested. clear the interrupt source by cpu or dtc data transfer. table 14.8 synchronous serial communication unit interrupt sources abbreviation interrupt source symbol interrupt condition dtc activation sseri overrun error ssoei (rie = 1) ? (orer = 1) ? conflict error sscei (ceie = 1) ? (ce = 1) ? ssrxi receive data register full ssrxi (rie = 1) ? (rdrf = 1) yes sstxi transmit data register empty sstxi (tie = 1) ? (tdre = 1) yes transmit end sstei (teie = 1) ? (tend = 1) ?
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 633 of 1080 rej09b0230-0300 14.6 usage notes 14.6.1 module standby mode setting the synchronous serial communication unit operation can be disabled or enabled using the standby control register. the initial setting is for synchronous serial comm unication unit operation to be halted. access to registers is enabled by clearing module standby mode. for details, refer to section 22, power-down modes. 14.6.2 access to sstdr and ssrdr registers do not access sstdr and ssrdr registers not validated by the setting of the dats bits of the sscrl register. if accessed, transmission or recep tion thereafter may not be performed normally. 14.6.3 continuous transmission/reception in sy nchronous serial co mmunication slave mode during continuous transmission/ reception in synchronous seri al communication slave mode, negate the scs pin (high level) for every frame. if the scs pin is kept asserted (low level) for more than one frame, transmission or reception cannot be performed correctly.
section 14 synchronous serial communication unit rev. 3.00 oct. 06, 2008 page 634 of 1080 rej09b0230-0300
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 635 of 1080 rej09b0230-0300 section 15 a/d converter (adc) this lsi includes a successive approximation type 12-bit a/d converter. 15.1 features ? 12-bit resolution ? input channels 16 channels (two independent a/d conversion modules) ? two operating modes ? single-cycle scan mode: continuous a/d conversion on one to eight channels ? continuous scan mode: repetitive a/d c onversion on one to eight channels ? sixteen 12-bit a/d data registers both a/d_0 and a/d_1 have eight registers and a total of sixteen 16-bit a/d data registers (addr) are included. a/d conversion results are stored in a/d data registers (addr) that correspond to the input channels. ? sample-and-hold function a sample-and-hold circuit is built into the a/d converter of this lsi, simplifying the configuration of the external analog input circuitry. multiple channels can be sampled simultaneously because sample-and-ho ld circuits can be dedicated for channels 0 to 2 and 8 to 10. ? group a (gra): analog input pins selected from channels 0, 1, and 2 can be simultaneously sampled. ? group b (grb): analog input pins selected from channels 8, 9, and 10 can be simultaneously sampled. ? three methods for starting conversion software: setting of the adst bit in adcr timer: trgan, trg0n, trg4an, and trg4bn from the mtu2 trgan, trg4an, and trg4bn from the mtu2s external trigger: adtrg (lsi pin) ? selectable analog input channel a/d conversion of a selected channel is acco mplished by setting the a/d analog input channel select registers (adansr). ? a/d conversion end interrupt and dtc transfer function is supported on completion of a/d conversion, a/d conversion end interrupts (adi_3 and adi_4) can be generated and the dtc can be activated by adi_3 and adi_4.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 636 of 1080 rej09b0230-0300 figure 15.1 shows a block diagram of the a/d converter. 12-bit d/a adansr_0 adcr_0 adsr_0 adstrgr_0 an0 an1 an2 an3 an4 an5 an6 an7 + ? comparator sample-and- hold circuit a/d 0 conversion control circuit avcc avss avrefh avrefl internal data bus a/d conversion end interrupt si g nal (adi_3) gra a/d_0 sample-and- hold circuit sample-and- hold circuit impedance- conversion circuit impedance- conversion circuit impedance- conversion circuit impedance- conversion circuit impedance- conversion circuit sample-and- hold circuit offset cancel circuit addr5 addr4 addr6 addr7 addr1 addr0 addr2 addr3 bus interface avcc avss avrefh avrefl 12-bit d/a successive approximation re g ister analo g multiplexer adansr_1 adcr_1 adsr_1 adstrgr_1 an8 an9 an10 an11 an12 an13 an14 an15 + ? comparator sample-and- hold circuit a/d 1 conversion control circuit avcc avss avrefh avrefl internal data bus a/d conversion end interrupt si g nal (adi_4) grb a/d_1 sample-and- hold circuit sample-and- hold circuit impedance- conversion circuit impedance- conversion circuit impedance- conversion circuit impedance- conversion circuit impedance- conversion circuit sample-and- hold circuit offset cancel circuit addr13 addr12 addr14 addr15 addr9 addr8 addr10 addr11 bus interface a/d tri gg er si g nal from mtu2 (trgan, trg0n, trg4an, trg4bn) a/d tri gg er si g nal from mtu2s (trgan, trg4an, trg4bn) external tri gg er si g nal ( adtrg ) [le g end] addr: adcr: adansr: adsr: adstrgr: gra: grb: a/d data re g ister a/d control re g ister a/d analo g input channel select re g ister a/d status re g ister a/d start tri gg er select re g ister group a group b successive approximation re g ister analo g multiplexer figure 15.1 block diagram of a/d converter
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 637 of 1080 rej09b0230-0300 15.2 input/output pins table 15.1 shows the configuration of the pins used by the a/d converter. for the pin usage, refer to the usage notes in s ection 15.7, usage notes. table 15.1 pin configuration module type pin name i/o function common av cc input analog block power supply pin av ss input analog block ground pin av refh input analog block reference power supply pin (high-side) (av refl < av refh ) av refl input analog block reference power supply pin (low-side) (av refl < av refh ) adtrg input a/d external trigger input pin an0 input analog input pin 0 (group a) a/d module 0 (a/d_0) an1 input analog input pin 1 (group a) an2 input analog input pin 2 (group a) an3 input analog input pin 3 an4 input analog input pin 4 an5 input analog input pin 5 an6 input analog input pin 6 an7 input analog input pin 7 an8 input analog input pin 8 (group b) a/d module 1 (a/d_1) an9 input analog input pin 9 (group b) an10 input analog input pin 10 (group b) an11 input analog input pin 11 an12 input analog input pin 12 an13 input analog input pin 13 an14 input analog input pin 14 an15 input analog input pin 15
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 638 of 1080 rej09b0230-0300 15.3 register descriptions the a/d converter has the following registers. table 15.2 register configuration register name abbreviation r/w initial value address access size a/d control register_0 adcr_0 r/w h'00 h'ffffd400 8 a/d status register_0 adsr_0 r/w h'00 h'ffffd402 8 a/d start trigger select register_0 adstrgr_0 r/w h'00 h'ffffd41c 8 a/d analog input channel select register_0 adansr_0 r/w h'00 h'ffffd420 8 a/d data register 0 addr0 r h'0000 h'ffffd440 16 a/d data register 1 addr1 r h'0000 h'ffffd442 16 a/d data register 2 addr2 r h'0000 h'ffffd444 16 a/d data register 3 addr3 r h'0000 h'ffffd446 16 a/d data register 4 addr4 r h'0000 h'ffffd448 16 a/d data register 5 addr5 r h'0000 h'ffffd44a 16 a/d data register 6 addr6 r h'0000 h'ffffd44c 16 a/d data register 7 addr7 r h'0000 h'ffffd44e 16 a/d control register_1 adcr_1 r/w h'00 h'ffffd600 8 a/d status register_1 adsr_1 r/w h'00 h'ffffd602 8 a/d start trigger select register_1 adstrgr_1 r/w h'00 h'ffffd61c 8 a/d analog input channel select register_1 adansr_1 r/w h'00 h'ffffd620 8 a/d data register 8 addr8 r h'0000 h'ffffd640 16 a/d data register 9 addr9 r h'0000 h'ffffd642 16 a/d data register 10 addr10 r h'0000 h'ffffd644 16 a/d data register 11 addr11 r h'0000 h'ffffd646 16 a/d data register 12 addr12 r h'0000 h'ffffd648 16 a/d data register 13 addr13 r h'0000 h'ffffd64a 16 a/d data register 14 addr14 r h'0000 h'ffffd64c 16 a/d data register 15 addr15 r h'0000 h'ffffd64e 16
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 639 of 1080 rej09b0230-0300 15.3.1 a/d control registers_0 and _1 (adcr_0 and adcr_1) adcrs are 8-bit readable/writabl e registers that select conv ersion mode for the a/d_0 and a/d_1. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r r r/w r/w adst adcs ace adie - - trge extrg bit bit name initial value r/w description 7 adst 0 r/w a/d start when this bit is cleared to 0, a/d conversion is stopped and the a/d converter enters the idle state. when this bit is set to 1, a/d conversion is started. in single-cycle scan mode, this bit is automatically cleared to 0 when a/d conversion ends on the selected single channel. in continuous scan mode, a/d conversion is continuously performed for the selected channels in sequence until this bit is cleared by software, a reset, or in software standby mode, hardware standby mode, or module standby mode. 6 adcs 0 r/w a/d continuous scan selects either a single-cycle or a continuous scan in scan mode. this bit is valid only when scan mode is selected. 0: single-cycle scan 1: continuous scan when changing the operating mode, first clear the adst bit to 0. 5 ace 0 r/w automatic clear enable enables or disables the automatic clearing of addr after addr is read by the cpu or dtc. when this bit is set to 1, addr is automatically cleared to h'0000 after the cpu or dtc reads addr. this function allows the detection of any renewal failures of addr. 0: automatic clearing of addr after being read is disabled. 1: automatic clearing of addr after being read is enabled.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 640 of 1080 rej09b0230-0300 bit bit name initial value r/w description 4 adie 0 r/w a/d interrupt enable enables or disables the generation of a/d conversion end interrupts (adi_3 and adi_4) to the cpu. operating modes must be changed when the adst bit is 0 to prevent incorrect operations. when a/d conversion ends and the adf bit in adsr is set to 1 and this bit is set to 1, adi_3 or adi_4 is sent to the cpu. by clearing the adf bit or the adie bit to 0, adi_3 and adi_4 can be cleared. 0: generation of a/d conversion end interrupt is disabled 1: generation of a/d conversion end interrupt is enabled 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 trge 0 r/w trigger enable enables or disables a/d conversion start by the external trigger input ( adtrg ) or a/d conversion start triggers from the mtu2 and mtu2s (trgan, trg0n, trg4an, and trg4bn from the mtu2 and trgan, trg4an, and trg4bn from the mtu2s). for selection of the external trigger and a/d conversion start trigger from the mtu2 or mtu2s, see the description of the extrg bit. 0: a/d conversion start by the external trigger or an a/d conversion start trigger from the mtu or mtu2s is disabled 1: a/d conversion start by the external trigger or an a/d conversion start trigger from the mtu2 or mtu2s is enabled
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 641 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 extrg 0 r/w trigger select selects the external trigger ( adtrg ) or an a/d conversion start trigger from the mtu2 or mtu2s as an a/d conversion start trigger. when the external trigger is selected (extrg = 1), upon input of a low-level pulse to the adtrg pin after the trge bit is set to 1, the a/d converter detects the falling edge of the pulse, and sets the adst bit in adcr to 1. the operation which is performed when 1 is written to the adst bit by software is subsequently performed. a/d conversion start by the external trigger input is enabled only when the adst bit is cleared to 0. when the external trigger is used as an a/d conversion start trigger, the low-level pulse input to the adtrg pin must be at least 1.5 p clock cycles in width. 0: a/d converter is started by the a/d conversion start trigger from the mtu2 or mtu2s 1: a/d converter is started by the external pin ( adtrg )
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 642 of 1080 rej09b0230-0300 15.3.2 a/d status registers_0 and _1 (adsr_0 and adsr_1) adsrs are 8-bit readable/writable registers that indicate the status of the a/d converter. bit: initial value: r/w: 7654321 0 00000000 r r r r r r r r/(w) * note: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. do not overwrite this bit with 0 when the value of this bit is 0. * -------adf bit bit name initial value r/w description 7 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 adf 0 r/(w) * a/d end flag a status flag that indicates the completion of a/d conversion. [setting condition] ? when a/d conversion on all specified channels is completed in scan mode [clearing conditions] ? when 0 is written after reading adf = 1 ? when the dtc is activated by an adi interrupt and addr is read note: * writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. do not overwrite this bit with 0 when the value of this bit is 0.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 643 of 1080 rej09b0230-0300 15.3.3 a/d start trigger select registers_0 and _1 (adstrgr_0 and adstrgr_1) adstrgrs select an a/d conversion start trigger from the mtu2 or mtu2s. the a/d conversion start trigger is used as an a/d conversion start source when the trge bit in adcr is set to 1 and the extrg bit in adcr is set to 0. bit: initial value: r/w: 7654321 0 00000000 r r/w r/w r/w r/w r/w r/w r/w - str6str5str4str3str2str1str0 bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 str6 0 r/w start trigger 6 enables or disables the a/d conversion start request input from the mtu2s. 0: disables the a/d conversion start by trgan trigger (mtu2s). 1: enables the a/d conversion start by trgan trigger (mtu2s). 5 str5 0 r/w start trigger 5 enables or disables the a/d conversion start request input from the mtu2s. 0: disables the a/d conversion start by trg4an trigger (mtu2s). 1: enables the a/d conversion start by trg4an trigger (mtu2s). 4 str4 0 r/w start trigger 4 enables or disables the a/d conversion start request input from the mtu2s. 0: disables the a/d conversion start by trg4bn trigger (mtu2s). 1: enables the a/d conversion start by trg4bn trigger (mtu2s).
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 644 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 str3 0 r/w start trigger 3 enables or disables the a/d conversion start request input from the mtu2. 0: disables the a/d conversion start by trg0n trigger (mtu2). 1: enables the a/d conversion start by trg0n trigger (mtu2). 2 str2 0 r/w start trigger 2 enables or disables the a/d conversion start request input from the mtu2. 0: disables the a/d conversion start by trgan trigger (mtu2). 1: enables the a/d conversion start by trgan trigger (mtu2). 1 str1 0 r/w start trigger 1 enables or disables the a/d conversion start request input from the mtu2. 0: disables the a/d conversion start by trg4an trigger (mtu2). 1: enables the a/d conversion start by trg4an trigger (mtu2). 0 str0 0 r/w start trigger 0 enables or disables the a/d conversion start request input from the mtu2. 0: disables the a/d conversion start by trg4bn trigger (mtu2). 1: enables the a/d conversion start by trg4bn trigger (mtu2).
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 645 of 1080 rej09b0230-0300 15.3.4 a/d analog input channel select registers_0 and _1 (adansr_0 and adansr_1) adansrs are 8-bit readable/wr itable registers that select an analog input channel. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w ans7 ans6 ans5 ans4 ans3 ans2 ans1 ans0 bit bit name initial value r/w description 7 6 5 4 3 2 1 0 ans7 ans6 ans5 ans4 ans3 ans2 ans1 ans0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w setting bits in the a/d analog input channel select register to 1 selects a channel that corresponds to a specified bit. for the correspondence between analog input pins and bits, see table 15.3. when changing the analog input channel, the adst bit in adcr must be cleared to 0 to prevent incorrect operations. table 15.3 channel select list analog input channels bit name a/d_0 a/d_1 ans0 an0 an8 ans1 an1 an9 ans2 an2 an10 ans3 an3 an11 ans4 an4 an12 ans5 an5 an13 ans6 an6 an14 ans7 an7 an15
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 646 of 1080 rej09b0230-0300 15.3.5 a/d data registers 0 to 15 (addr0 to addr15) addrs are 16-bit read-only registers. the convers ion result for each analog input channel is stored in addr with the corresponding number. (see table 15.4.) the converted 12-bit data is stored in bits 11 to 0. the initial value of addr is h'0000. after addr is read, addr can be automatically cleared to h'0000 by setting the ace bit in adcr to 1. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrrrrrrrrr - - - - add[11:0] bit bit name initial value r/w description 15 to 12 ? all 0 r reserved 11 to 0 add[11:0] all 0 r 12-bit data table 15.4 correspondence between analog ch annels and registers (addr0 to addr15) a/d_0 converter a/d_1 converter analog input channels a/d data registers analog input channels a/d data registers an0 addr0 an8 addr8 an1 addr1 an9 addr9 an2 addr2 an10 addr10 an3 addr3 an11 addr11 an4 addr4 an12 addr12 an5 addr5 an13 addr13 an6 addr6 an14 addr14 an7 addr7 an15 addr15
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 647 of 1080 rej09b0230-0300 15.3.6 cpu interface since the internal bus connected to the cpu is 16 bits wide, the upper and lower bytes of data can be read simultaneously. peripheral modules 16 bits 12-bit a/d rcan-et mtu2 mtu2s . . . . . . . . intc hpb bus figure 15.2 interface between cpu and 12-bit a/d converter
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 648 of 1080 rej09b0230-0300 15.4 operation the a/d converter has two operating modes: single-cycle scan mode and continuous scan mode. in single-cycle scan mode, a/d conversion is performed once on one or more specified channels and then it ends. in continuous scan mode, the a/d conversion is performed sequentially on one or more specified channels until the adst bit is cleared to 0. the adcs bit in the a/d control register (adcr) is used to select the operating mode. setting the adcs bit to 0 selects single-cycle scan mode and setting the adcs bit to 1 selects continuous scan mode. in both modes, a/d conversion starts on the channel with the lowest number in the analog input channels selected by the a/d analog input channel select register (adansr). the a/d_0 performs conversions from an0 to an7 and a/d_1 from an8 to an15. in single-cycle scan mode, when one cycle of a/d conversion on all specified channels is completed, the adf bit in adsr is set to 1 and the adst bit is automatically cleared to 0. in continuous scan mode, when conversion on all specified channels is completed, the adf bit in adsr is set to 1. to stop a/d conversion, write 0 to the adst bit. when the adf bit is set to 1, if the adie bit in adcr is set to 1, an a/d conversion end interrupt (adi) is generated. when clearing the adf bit to 0, read the adf bit while set to 1 and then write 0. however, when the dtc is activated by an adi interrupt, the adf bit is automatically cleared to 0. 15.4.1 single-cycle scan mode the following example shows the ope ration when analog input channe ls 0 to 3 (an0 to an3) are selected and the a/d_0 conversion is performed in single-cycle scan mode using four channels. this operation also applies to the a/d_1 conversion. 1. set the adcs bit in the a/d control register_0 (adcr_0) to 0. 2. set all bits ans0 to ans3 in the a/d analog input channel select register_0 (adansr_0) to 1. 3. set the adst bit in the a/d control register_0 (adcr_0) to 1 to start a/d conversion. 4. after channels 0 to 2 (gra) are sampled simultaneously, offset canceling processing (ofc) is performed. then, a/d conversion is performed on channel 0. upon completion of the a/d conversion, the a/d conversion result is tran sferred to addr0. following this, channel 1 is converted. upon completion of the conversion, the a/d conversion result is transferred to addr1. in the same way, channel 2 is converte d and the a/d conversion result is transferred to addr2. a/d conversion of channel 3 is then started. upon completion of the a/d conversion, the a/d conversion result is transferred to addr3.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 649 of 1080 rej09b0230-0300 5. when a/d conversion ends on all specified channels (an0 to an3), the adf bit is set to 1, the adst bit is automatically cleared to 0, and the a/d conversion ends. at this time, if the adie bit is set to 1, an adi_3 interrupt is generated after the a/d conversion. adst adf s an0 an1 an2 an3 addr0 addr1 addr2 addr3 s h s h ofc h ofc h ofc h ofc waitin g for conversion waitin g for conversion a/d conversion a/d conversion result (an0) a/d conversion result (an1) a/d conversion result (an2) [le g end] adst set adst automatically cleared adf cleared waitin g for conversion a/d conversion waitin g for conversion a/d conversion waitin g for conversion waitin g for conversion waitin g for conversion a/d conversion a/d conversion result (an3) waitin g for conversion waitin g for conversion a/d conversion execution simultaneous samplin g simultaneous samplin g simultaneous samplin g ofc: s: h: offset cancelin g processin g samplin g holdin g figure 15.3 example of a/d_0 converter operation (single-cycle scan mode)
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 650 of 1080 rej09b0230-0300 15.4.2 continuous scan mode the following example shows the operation when analog input channels 0, 2, and 3 (an0, an2, an3) are selected and the a/d_0 conversion is performed in continuous scan mode using the three channels. this operation also applies to the a/d_1 conversion. 1. set the adcs bit in the a/d control register_0 (adcr_0) to 0. 2. set all bits ans0, ans2, and ans3 in the a/d analog input channel select register_0 (adansr_0) to 1. 3. set the adst bit in the a/d control register_0 (adcr_0) to 1 to start a/d conversion. 4. channels 0 and 2 (gra) are sampled simultaneously. as the ans1 bit in adansr_0 is set to 0, channel 1 is not sampled. after this, offset canceling processing (ofc) is performed. then the a/d conversion on channel 0 is started. upon completion of the a/d conversion, the a/d conversion result is transferred to addr0. in th e same way, channel 2 is converted and the a/d conversion result is transferred to addr 2. the a/d conversion is not performed on channel 1. 5. the a/d conversion of channel 3 is started. upon completion of the a/d conversion, the a/d conversion result is transferred to addr3. 6. when the a/d conversion ends on all the specified channels (an0 to an3), the adf bit is set to 1. at this time, if the adie bit is set to 1, an adi_3 interrupt is generated after the a/d conversion. 7. steps 4 to 6 are repeated as long as the adst bit remains set to 1. when the adst bit is cleared to 0, the a/d conversion stops. after this, if the adst bit is set to 1, the a/d conversion starts again and repeats steps 4 to 6.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 651 of 1080 rej09b0230-0300 adst adf an0 an1 an2 an3 addr0 addr1 addr2 addr3 h s s h s ofc ofc h ofc h ofc s s ofc ofc h ofc h ofc s a/d conversion a/d conversion a/d conversion result (an0) a/d conversion result (an2) waitin g for conversion waitin g for conversion waitin g for conversion waitin g for conversion waitin g for conversion a/d conversion a/d conversion waitin g for conversion waitin g for conversion waitin g for conversion waitin g for conversion waitin g for conversion a/d conversion a/d conversion a/d conversion result (an3) a/d conversion result (an0) a/d conversion result (an2) a/d conversion result (an3) waitin g for conversion stop stop (1) (2) (1) (2) (1) (2) (1) (2) (1) (2) (1) (2) waitin g for conversion waitin g for conversion waitin g for conversion waitin g for conversion waitin g for conversion simultaneous samplin g simultaneous samplin g adst set adst cleared * adf cleared a/d conversion execution * note: [le g end] ofc: s: h: offset cancelin g processin g samplin g holdin g instruction execution by software figure 15.4 example of a/d_0 converter operation (continuous scan mode)
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 652 of 1080 rej09b0230-0300 15.4.3 input sampling and a/d conversion time the a/d_0 has a built-in sample-and-hold circuit common to all the channels. each of channels 0 to 2 of the a/d_0 has a dedicated built-in sample-and-hold circuit. channels 0 to 2 can be simultaneously sampled as one group. this group is referred to as group a (gra) (in table 15.5). even when only one channel is selected in the group by adansr, the sample-and-hold operation is performed with the dedicated sample-and-hold circuit. when only the channels without a dedicated sample-and-hold circuit are specified by adansr, the time that elapses is the same as when a dedicated sample-and-hold circuit is used. the above descriptions is the same with the a/d_1. when an event that sets the adst bit writing to this bit by the cpu, a/d converter activation request from the mtu2, the mtu2s, and an extern al trigger signal occurs, the analog input is sampled by the dedicated sample-a nd-hold circuit for each channel after the a/d conversion start delay time (t d ) has passed and the offset canceling processing (ofc) is performed. after this, the sampling of the analog input using the sample-and-hold circuit common to all the channels is performed and then the a/d conversion is started. figure 15.5 shows the a/d conversion timing in this case. this a/d conversion time (t conv ) includes the t d , the offset canceling processing time (t ofc ), the analog input sampling time with a dedicated sample-and-hold circuit for each channel (t splsh ), and the analog input sampling time with the sample-and-hold circuit common to all the channels (t spl ). the t splsh does not depend on the number of channels simultaneously sampled. in continuous scan mode, the a/d conversion time (t conv ) given in table 15.6 applies to the conversion time of the first cycle. the conversion time of the second and subsequent cycles is expressed as (t conv ? t d + 6).
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 653 of 1080 rej09b0230-0300 table 15.5 correspondence between analog input channels and groups being allowed simultaneous sampling a/d_0 converter a/d_1 converter analog input channels group analog input channels group an0 gra an8 grb an1 an9 an2 an10 an3 ? an11 ? an4 ? an12 ? an5 ? an13 ? an6 ? an14 ? an7 ? an15 ? table 15.6 a/d conversion time number of required states item symbol min. typ. max. a/d conversion start delay time t d 11 * 1 ? 15 * 2 analog input sampling time of dedicated sample-and-hold circuit for gra and grb t splsh ? 30 ? offset canceling processing time t ofc ? 50 ? analog input sampling time of sample- and-hold circuit common to all channels t spl ? 20 ? a/d conversion time t conv 50n + 95 * 3 ? 50n + 99 * 3 notes: 1. a/d converter activation by the mtu2 or mtu2s trigger signal. 2. a/d converter activation by an external trigger signal. 3. n: number of a/d conversion channels (n = 1 to 8)
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 654 of 1080 rej09b0230-0300 t ofc ofc addr conversion time per channel 50 states p = 32 mhz: 1.56 s p = 40mhz: 1.25 s adf adst trgan (mtu2, mtu2s tri gg er si g nal) notes: 1. sample-and-hold circuit for gra and grb 2. sample-and-hold circuit common to all channels a/d conversion time (t conv ) t d samplin g and hold time (t splsh ) samplin g and hold time (t spl ) a/d converter waitin g waitin g sample- and-hold * 1 a/d conversion end of a/d conversion sample- and-hold * 2 figure 15.5 a/d conversion timi ng (single-cycle scan mode) 15.4.4 a/d converter activation by mtu2 and mtu2s a/d conversion is activated by the a/d conversi on start triggers (trgan, trg0n, trg4n, and trg4bn) from the mtu2 and a/d conversion st art triggers (trgan, trg4an, and trg4bn) from the mtu2s. to enable this function, set the trge bit in adcr to 1 and clear the extrg bit to 0. after this setting is made, if an a/d conversion start trigger from the mtu2 or mtu2s is generated, the adst bit is set to 1. the timing between the setting of the adst bit and the start of the a/d conversion is the same fo r all a/d conversion activation sources. the a/d conversion start trigger must be input after adcr, adstrgr, and adansr registers have been set.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 655 of 1080 rej09b0230-0300 15.4.5 external trigger input timing the a/d conversion can be externally triggered. to input an external trigger, set the pin function controller (pfc) to select adtrg pin function and drive the adtrg pin low when a high level is input to the adtrg pin with the trge and extrg bits in adcr are both set to 1. a falling edge of the adtrg pin sets the adst bit in adcr to 1, starting the a/d conversion. other operations are conducted in the same way for a ll a/d conversion activation sources. figure 15.6 shows the timing. the adst bit is set to 1 after 5 states has elap sed from the point at which the a/d converter detects a falling edge on the adtrg pin. a low level input to the adtrg pin must be made after the adcr, adstrgr, and adansr registers have been set. a/d conversion p adtrg external tri gg er si g nal adst figure 15.6 external trigger input timing 15.4.6 example of addr auto-clear function when the a/d data register (addr) is read by the cpu or dtc, addr can be automatically cleared to h'0000 by setting the ace bit in adcr to 1. this function allows the detection of an addr renewal failure. figure 15.7 shows an example of when the auto-clear function of addr is disabled (normal state) and enabled.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 656 of 1080 rej09b0230-0300 when the ace bit is 0 (initial value) and the a/d conversion result (h'0222) is not written to addr for some reason, the old data (h'0111) b ecomes the addr value. in addition, when the addr value is read into a general register using an a/d conversion end interrupt, the old data (h'0111) is stored in the general register. to detect a renewal failure, every time the old data needs to be stored in the ram, a general register, etc. when the ace bit is 1, reading addr = h'0111 by the cpu or dtc automatically clears addr to h'0000. after this, if the a/d conversion result (h'0222) cannot be transferred to addr for some reason, the cleared data (h'0000) remains as the addr value. when this addr value is read into a general register, h'0000 is stored in the general register. just by checking whether the read data value is h'0000 or not allows the detection of an addr renewal failure. a/d conversion result a/d conversion result ? ace bit = 0 (normal condition: auto-clear function is disabled.) ? ace bit = 1 (auto-clear function is enabled.) a/d data re g ister (addr) a/d conversion end interrupt ram, g eneral re g ister etc. h'0111 h'0222 h'0333 h'0444 addr renewal failure read read read because addr is not renewed, old data is used. however, it is impossible to know that the data is old or not. automatic clearin g after read when h'0000 is read, a failure is detected by software. h'0111 h'0000 h'0333 h'0111 h'0000 h'0333 h'0000 a/d data re g ister (addr) a/d conversion end interrupt ram, g eneral re g ister etc. h'0111 h'0222 h'0333 h'0444 addr renewal failure read read read h'0111 h'0333 h'0111 h'0333 automatic clearin g after read automatic clearin g after read figure 15.7 example of when addr auto-clear function is disabled (normal condition)/enabled
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 657 of 1080 rej09b0230-0300 15.5 interrupt sources and dtc transfer requests the a/d converter generates a/d conversion end interrupts (adi_3 and adi_4). an adi_3 interrupt generation is enabled when the adie bit in adcr_0 is set to 1. an adi_4 interrupt generation is enabled when the adie bit in adcr_1 is set to 1. on the other hand, an adi_3 interrupt generation is disabled when the adie bit in adcr_0 is cleared to 0, and an adi_4 interrupt generation is disabled when the adie bit in adcr_1 is cleared to 0. the data transfer controller (dtc) can be activated by the dtc setting when an adi_3 or adi_4 interrupt is generated. when the dtc is activated by an adi_3 or an adi_4 interrupt, the adf bit in adsr_0 and adsr_1 is automatically cleared.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 658 of 1080 rej09b0230-0300 15.6 definitions of a/d conversion accuracy this lsi's a/d conversion accuracy definitions are given below. ? resolution the number of a/d converter digital conversion output codes ? offset error the deviation of the actual a/d conversion characteristic from the ideal a/d conversion characteristic when the digital output value changes from the minimum voltage value (zero voltage) b'000000000000 to b'000000000001. does not include a quantization error (see figure 15.8). ? full-scale error the deviation of the actual a/d conversion characteristic from the ideal a/d conversion characteristic when the digital output value changes from b'111111111110 to the maximum voltage value (full-scale voltage) b'111111111111. does not include a quantization error (see figure 15.8). ? quantization error the deviation inherent in the a/d converter, given by 1/2 lsb (see figure 15.8). ? nonlinearity error the deviation of the actual a/d conversion characteristic from the ideal a/d conversion characteristic between zero voltage and full-scale voltage. does not include offset error, full- scale error, or quantizati on error (see figure 15.8). ? absolute accuracy the deviation between the digital value and the analog input value. includes offset error, full- scale error, quantization erro r, and nonlinearity error.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 659 of 1080 rej09b0230-0300 di g ital output 111 110 101 100 011 010 001 000 1/8 2/8 3/8 4/8 5/8 6/8 7/8 fs 0 analo g input volta g e quantization error ideal a/d conversion characteristic di g ital output fs analo g input volta g e offset error ideal a/d conversion characteristic actual a/d conversion characteristic full-scale error nonlinearity error [le g end] fs: full-scale figure 15.8 definitions of a/d conversio n accuracy
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 660 of 1080 rej09b0230-0300 15.7 usage notes 15.7.1 analog input voltage range the voltage applied to analog input pin (ann) during a/d conversion should be in the range av refl ann (n = 0 to 15) av refh . 15.7.2 relationship between avcc, avss and vcc, vss when using the a/d converter, set avcc = 5.0 v 0.5 v and avss = vss. when the a/d converter is not used, set avss = vss, and do not leave the avcc pin open. 15.7.3 range of av refh and av refl pin settings when using the a/d converter, set av refh = 4.5 to avcc. when the a/d converter is not used, set av refh avcc. if these conditions are not met, the reliability of the lsi may be adversely affected. for av refl , set av refl = avss = vss. 15.7.4 notes on board design in board design, digital circuitry and analog circuitry should be as mutually isolated as possible, and the layout in which the digital circuit signal lines and analog circuit signal lines cross or are in close proximity to each other should be avoided as much as possible. failure to do so may result in the incorrect operation of the analog circuitry due to inductance, adversely affecting the a/d conversion values. also, digital circuitry must be isolated from the analog input signals (an0 to an15), analog reference power supply (av refh and av refl ), the analog power supply (avcc), and the analog ground (avss). also, avss should be connected at one point to a stable digital ground (vss) on the board. 15.7.5 notes on noise countermeasures to prevent damage due to an abnormal voltage, such as an excessive surge at the analog input pins (an0 to an15) and analog reference power supply (av refh , av refl ), a protection circuit should be connected between the avcc and avss, as shown in figure 15.9. also, the bypass capacitors connected to av refh and av refl and the filter capacitor connected to ann should be connected to the avss. if a filter capacitor is connected as shown in figure 15.9, the input currents at the analog input pin (ann) are averaged, and an error may occur. careful consideration is therefore required when deciding the circuit constants.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 661 of 1080 rej09b0230-0300 4.5 v to 5.5 v 0.0 v 10 f 0.1 f 0.1 f analo g input pin analo g input pin 3 k 3 k 0.1 f 0.1 f avcc avss avrefh avrefl an0 to an7 an8 to an15 this lsi figure 15.9 example of analog input pin protection circuit 15.7.6 notes on register setting ? set the adst bit in the a/d control register (adcr) after the a/d start trigger select register (adstrgr) and the a/d analog input channel sel ect register (adansr) have been set. do not modify the settings of the adcs, ace, adie, trge, and extrg bits while the adst bit in the adcr register is set to 1. ? do not start the a/d conversion when the ans bits (ans[7:0]) in the a/d analog input channel select register (adansr) are all 0.
section 15 a/d converter (adc) rev. 3.00 oct. 06, 2008 page 662 of 1080 rej09b0230-0300
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 663 of 1080 rej09b0230-0300 section 16 compare match timer (cmt) this lsi has an on-chip compare match timer (cmt) consisting of a 2-channel 16-bit timer. the cmt has a16-bit counter, and can generate interrupts at set intervals. 16.1 features ? selection of four counter input clocks any of four internal clocks (p /8, p /32, p /128, and p /512) can be selected independently for each channel. ? interrupt request on compare match ? module standby mode can be set. figure 16.1 shows a block diagram of cmt. control circuit clock selection cmstr cmcsr_0 cmcor_0 cmcnt_0 channel 0 channel 1 cmt p /8 cmcsr_1 cmcor_1 cmcnt_1 p /32 p /128 p /512 p /8 p /32 p /128 p /512 clock selection control circuit comparator comparator [le g end] cmstr: compare match timer start re g ister cmcsr: compare match timer control/status re g ister cmcor: compare match timer constant re g ister cmcnt: compare match counter cmi: compare match interrupt module bus bus interface internal bus cmi0 cmi1 figure 16.1 block diagram of cmt
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 664 of 1080 rej09b0230-0300 16.2 register descriptions the cmt has the following registers. for details on register addresses and register states during each processing, refer to section 24, list of regist ers. to distinguish registers in each channel, an underscore and the channel number are added as a suffix to the register name. table 16.1 register configuration register name abbreviation r/w initial value address access size compare match timer start register cmstr r/w h'0000 h'ffffce00 8, 16, 32 compare match timer control/status register_0 cmcsr_0 r/w h'0000 h'ffffce02 8, 16 compare match counter_0 cmcnt_0 r/w h'0000 h'ffffce04 8, 16, 32 compare match constant register_0 cmcor_0 r/w h'ffff h'ffffce06 8, 16 compare match timer control/status register_1 cmcsr_1 r/w h'0000 h'ffffce08 8, 16, 32 compare match counter_1 cmcnt_1 r/w h'0000 h'ffffce0a 8, 16 compare match constant register_1 cmcor_1 r/w h'ffff h'ffffce0c 8, 16, 32
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 665 of 1080 rej09b0230-0300 16.2.1 compare match timer start register (cmstr) cmstr is a 16-bit register that selects whether compare match counter (cmcnt) operates or is stopped. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrrrrrrrr/wr/w - - - - - - - - - - - - - - str1 str0 bit bit name initial value r/w description 15 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 str1 0 r/w count start 1 specifies whether compare match counter 1 operates or is stopped. 0: cmcnt_1 count is stopped 1: cmcnt_1 count is started 0 str0 0 r/w count start 0 specifies whether compare match counter 0 operates or is stopped. 0: cmcnt_0 count is stopped 1: cmcnt_0 count is started 16.2.2 compare match timer contro l/status register (cmcsr) cmcsr is a 16-bit register that indicates compare match generation, enables interrupts and selects the counter input clock. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrr(r/w) * 1 r/w r r r r r/w r/w note: writin g 0 to this bit after readin g it as 1 clears the fla g and is the only allowed way. 1. - - - - - - - - cmf cmie - - - - cks[1:0]
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 666 of 1080 rej09b0230-0300 bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 cmf 0 r/(w) * 1 compare match flag indicates whether or not the values of cmcnt and cmcor match. 0: cmcnt and cmcor values do not match [clearing conditions] ? when 0 is written to this bit * 2 ? when cmt registers are accessed when the value of the disel bit of mrb in the dtc is 0 after activating the dtc by cmi interrupts. [setting condition] 1: cmcnt and cmcor values match 6 cmie 0 r/w compare match interrupt enable enables or disables compare match interrupt (cmi) generation when cmcnt and cmcor values match (cmf = 1). 0: compare match interrupt (cmi) disabled 1: compare match interrupt (cmi) enabled 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1, 0 cks[1:0] 00 r/w clock select 1 and 0 select the clock to be input to cmcnt from four internal clocks obtained by dividing the peripheral operating clock (p ). when the str bit in cmstr is set to 1, cmcnt starts counting on the clock selected with bits cks1 and cks0. 00: p /8 01: p /32 10: p /128 11: p /512 notes: 1. writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. 2. if the flag is set by another compare match before writing 0 to the bit after reading it as 1, the flag will not be cleared by writing 0 to it once. in this case, read the bit as 1 again and write 0 to it.
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 667 of 1080 rej09b0230-0300 16.2.3 compare match counter (cmcnt) cmcnt is a 16-bit register used as an up-counter. when the counter input clock is selected with bits cks1 and cks0 in cmcsr and the str bit in cmstr is set to 1, cmcnt starts counting using the selected clock. when the value in cmcnt and the value in comp are match constant register (cmcor) match, cmcnt is cleared to h'0000 and the cmf flag in cmcsr is set to 1. the initial value of cmcnt is h'0000. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 16.2.4 compare match constant register (cmcor) cmcor is a 16-bit register that sets the interval up to a compare match with cmcnt. the initial value of cmcor is h'ffff. bit: initial value: r/w: 151413121110987654321 0 1111111111111111 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 668 of 1080 rej09b0230-0300 16.3 operation 16.3.1 interval count operation when an internal clock is selected with bits cks1 and cks0 in cmcsr and the str bit in cmstr is set to 1, cmcnt starts incrementing us ing the selected clock. when the values in cmcnt and cmcor match, cmcnt is cleared to h'0000 and the cmf flag in cmcsr is set to 1. when the cmie bit in cmcsr is set to 1, a compare match interrupt (cmi) is requested. cmcnt then starts counting up again from h'0000. figure 16.2 shows the operation of the compare match counter. cmcor h'0000 cmcnt value time counter cleared by compare match with cmcor figure 16.2 counter operation 16.3.2 cmcnt count timing one of four internal clocks (p /8, p /32, p /128, and p /512) obtained by dividing the p clock can be selected with bits cks1 and cks0 in cmcsr. figure 16.3 shows the timing. peripheral operatin g clock (p ) nth clock (n + 1)th clock count clock cmcnt n n + 1 figure 16.3 count timing
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 669 of 1080 rej09b0230-0300 16.4 interrupts 16.4.1 cmt interrupt sources and dtc activation the cmt has channels and each of them to which a different v ector address is allocated has compare match interrupt. when both the interrupt request flag (cmf) and interrupt enable bit (cmie) are set to 1, the corresponding interrupt request is output. when the interrupt is used to activate a cpu interrupt, the priority of channels can be changed by the interrupt controller settings. for details, see section 6, interrupt controller (intc). the data transfer controller (dtc) can be activat ed by an interrupt request. in this case, the priority between channels is fixed. see section 8, data transfer controller (dtc), for details. 16.4.2 timing of setting compare match flag when cmcor and cmcnt match, a compare match signal is generated and the cmf bit in cmcsr is set to 1. the compare match signal is generated in the last cycle in which the values match (when the cmcnt value is updated to h'0000). that is, after a match between cmcor and cmcnt, the compare match signal is not generated until the next cmcnt counter clock input. figure 16.4 shows the timing of cmf bit setting. n peripheral operatin g clock (p ) counter clock cmcnt cmcor compare match si g nal (n + 1)th clock n 0 figure 16.4 timing of cmf setting 16.4.3 timing of clearing compare match flag the cmf bit in cmcsr is cleared by reading 1 from this bit, then writing 0.
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 670 of 1080 rej09b0230-0300 16.5 usage notes 16.5.1 module standby mode setting the cmt operation can be disabled or enabled using the standby control register. the initial setting is for cmt operation to be halted. access to a register is enabled by clearing module standby mode. for details, refer to section 22, power-down modes. 16.5.2 conflict between write and compa re-match processes of cmcnt when the compare match signal is generated in the t2 cycle while wr iting to cmcnt, clearing cmcnt has priority over writing to it. in this case, cmcnt is not written to. figure 16.5 shows the timing to clear the cmcnt counter. peripheral operatin g clock (p ) address internal write counter clear cmcnt t1 t2 n h'0000 cmcsr write cycle cmcnt figure 16.5 conflict between write a nd compare-match processes of cmcnt
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 671 of 1080 rej09b0230-0300 16.5.3 conflict between word-write and count-up processes of cmcnt even when the count-up occurs in the t2 cycle while writing to cmcnt in words, the writing has priority over the count-up. in this case, the count-up is not performed. figure 16.6 shows the timing to write to cmcnt in words. m (cmcnt write data) cmcnt count-up enable peripheral operatin g clock (p ) address internal write cmcnt t1 t2 n cmcsr write cycle cmcnt figure 16.6 conflict between word-write and count-up processes of cmcnt
section 16 compare match timer (cmt) rev. 3.00 oct. 06, 2008 page 672 of 1080 rej09b0230-0300 16.5.4 conflict between byte-write and count-up processes of cmcnt even when the count-up occurs in the t2 cycle while writing to cmcnt in bytes, the byte-writing has priority over the count-up. in this case, the count-up is not performed. the byte data on another side, which is not written to, is also not counted and the previous contents remain. figure 16.7 shows the timing when the count-up occurs in the t2 cycle while writing to cmcnt in bytes. m (cmcnt write data) xx cmcnth cmcnt count-up enable cmcnth cmcntl peripheral operatin g clock (p ) address internal write t1 t2 n cmcsr write cycle figure 16.7 conflict between byte-write and count-up processes of cmcnt 16.5.5 compare match between cmcnt and cmcor do not set the same value in cmcnt and cmcor while cmcnt is not counting. if set, the cmf bit in cmcsr is set to 1 and cmcnt is cleared to h'0000.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 673 of 1080 rej09b0230-0300 section 17 controller area network (rcan-et) 17.1 summary 17.1.1 overview this document primarily describes the programming interface for the rcan-et module. it serves to facilitate the hardware/sof tware interface so that engineers involved in the rcan-et implementation can ensure the design is successful. 17.1.2 scope the can data link controller function is not descri bed in this document. it is the responsibility of the reader to investigate th e can specification document (see references). the interfaces from the can controller are described, in so far as they pertain to the co nnection with the user interface. the programming model is described in some detail. it is not the intention of this document to describe the implementation of the programming inte rface, but to simply pr esent the interface to the underlying can functionality. the document places no constraints upon the impl ementation of the rcan-et module in terms of process, packaging or power supply criteria. these issues are resolved where appropriate in implementation specifications. 17.1.3 audience in particular this document provides the design reference for software authors who are responsible for creating a can application using this module. in the creation of the rcan-et user interface lsi engineers must use this document to understand the hardware requirements.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 674 of 1080 rej09b0230-0300 17.1.4 references 1. can licence specification, robert bosch gmbh, 1992 2. can specification version 2.0 part a, robert bosch gmbh, 1991 3. can specification version 2.0 part b, robert bosch gmbh, 1991 4. implementation guide for the can protocol, can specification 2.0 addendum, can in automation, erlangen, germany, 1997 5. road vehicles - controller area network (can): part 1: data link layer and physical signalling (iso-11898-1, 2003) 17.1.5 features ? supports can specification 2.0b ? bit timing compliant with iso-11898-1 ? 16 mailbox version ? clock 16 to 40mhz ? 15 programmable mailboxes for transm it / receive + 1 receive-only mailbox ? sleep mode for low power consumption and automatic recovery from sleep mode by detecting can bus activity ? programmable receive filter mask (standard and extended identifier) supported by all mailboxes ? programmable can data rate up to 1mbit/s ? transmit message queuing with internal priority sorting mechanism against the problem of priority inversion for real-time applications ? data buffer access without sw hands hake requirement in reception ? flexible micro-controller interface ? flexible interrupt structure
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 675 of 1080 rej09b0230-0300 17.2 architecture the rcan-et device offers a flexible and sophisticated way to organise and control can frames, providing the compliance to can2.0b active and iso-11898-1. the module is formed from 5 different functional entities. these are the micro processor interface (mpi), mailbox, mailbox control and can interface. the figure be low shows the block diagram of the rcan-et module. the bus interface timing is designed accordin g to the peripheral bus i/f required for each product. irr gsr mcr imr mailbox 0 - 15 (ram) mailbox8 mailbox9 mailbox10 mailbox11 mailbox12 mailbox13 mailbox14 mailbox15 mailbox0 mailbox1 mailbox2 mailbox3 mailbox4 mailbox5 mailbox6 mailbox7 mailbox control micro processor interface control0 lafm data can interface ctx0 crx0 txpr txcr rxpr txack aback mbimr tec rec mailbox 0 - 15 (re g ister) mailbox8 mailbox9 mailbox10 mailbox11 mailbox12 mailbox13 mailbox14 mailbox15 mailbox0 mailbox1 mailbox2 mailbox3 mailbox4 mailbox5 mailbox6 mailbox7 control1 rfpr umsr 32-bit internal bus system transmit buffer receive buffer control si g nals status si g nals can core bcr 16-bit peripheral bus clkp preset_n pms_can_n p_read_n p_write_n psize_n pwait_can_n pa pd irqs scan_mode figure 17.1 rcan-et architecture
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 676 of 1080 rej09b0230-0300 important: although core of rcan-et is designed based on a 32-bit bus system, the whole rcan-et including mpi for the cpu has 16-bit bus interface to cpu. in that case, longword (32-bit) access must be implemented as 2 consecu tive word (16-bit) accesse s. in this manual, longword access means the two consecutive accesses. ? micro processor interface (mpi) the mpi allows communication between the renesas cpu and rcan-et?s registers/mailboxes to control the memory interf ace. it also contains the wakeup control logic that detects the can bus activities and notifies the mpi and the other parts of rcan-et so that the rcan-et can automatically exit the sleep mode. it contains registers such as mcr, irr, gsr and imr. ? mailbox the mailboxes consists of ram configured as message buffers and registers. there are 16 mailboxes, and each mailbox has the following information. ? can message control (identifier, rtr, ide, etc) ? can message data (for can data frames) ? local acceptance filter mask for reception ? can message control (dlc) ? 3-bit wide mailbox configuration, disable automatic re-transmission bit, auto- transmission for remote request bit, new message control bit ? mailbox control the mailbox control handles the following functions: ? for received messages, compare the ids and ge nerate appropriate ram addresses/data to store messages from the can in terface into the mailbox and se t/clear appropriate registers accordingly. ? to transmit messages, rcan-et will run the internal arbitration to pick the correct priority message, and load the message from the mailbox into the tx-buffer of the can interface and set/clear appropria te registers accordingly. ? arbitrates mailbox accesses between the cpu and the mailbox control. ? contains registers such as txpr, txcr, txack, aback, rxpr, rfpr, umsr and mbimr.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 677 of 1080 rej09b0230-0300 ? can interface this block conforms to the requirements for a can bus data link controller which is specified in ref. [2, 4]. it fulfils all the func tions of a standard dlc as specified by the osi 7 layer reference model. this functional entity also provides the registers and the logic which are specific to a given can bus, which include s the receive error counter, transmit error counter, the bit configuration registers and various useful test modes. this block also contains functional entities to hold the data r eceived and the data to be transmitted for the can data link controller.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 678 of 1080 rej09b0230-0300 17.3 programming model - overview the purpose of this programming interface is to allow convenient, effec tive access to the can bus for efficient message transfer. pl ease bear in mind that the user manual reports all settings allowed by the rcan-et ip. different use of rcan-et is not allowed. 17.3.1 memory map the diagram of the memory map is shown below. h'000 h'002 h'004 h'006 h'008 h'00a h'00c h'020 h'022 h'02a h'032 h'03a h'042 h'04a h'052 h'05a h'0a0 h'0a4 h'100 h'104 h'108 h'10a h'10c h'10e h'110 h'120 h'140 h'160 h'2e0 bit 15 bit 0 bit 15 bit 0 master control re g ister (mcr) general status re g ister(gsr) bit confi g uration re g ister 1 (bcr1) bit confi g uration re g ister 0 (bcr0) interrupt request re g ister (irr) interrupt mask re g ister (imr) mailbox-0 control 1 (nmc, mbc, dlc) mailbox-1 control/lafm/data etc. mailbox 0 data (8 bytes) mailbox-2 control/lafm/data etc. mailbox-3 control/lafm/data etc. mailbox-15 control/lafm/data etc. transmit pendin g re g ister (txpr1) transmit pendin g re g ister (txpr0) transmit cancel re g ister (txcr0) transmit acknowled g e re g ister (txack0) abort acknowled g e re g ister (aback0) receive pendin g re g ister (rxpr0) remote frame pendin g re g ister (rfpr0) mailbox interrupt mask re g ister (mbimr0) unread messa g e status re g ister (umsr0) transmit error counter (tec) receive error counter (rec) 0 2 4 6 1 3 5 7 mailbox-0 control 0 (stdid, extid, rtr, ide) lafm figure 17.2 rcan-et memory map the locations not used (between h'000 and h' 2f2) are reserved and cannot be accessed.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 679 of 1080 rej09b0230-0300 17.3.2 mailbox structure mailboxes play a role as message buffers to transmit / receive can frames. each mailbox is comprised of 3 identical storage fields that ar e 1): message control, 2): local acceptance filter mask, 3): message data. the following table shows the address map for the control, lafm, data and addresses for each mailbox. address control0 lafm data control1 mailbox 4 bytes 4 bytes 8 bytes 2 bytes 0 (receive only) 100 ? 103 104? 107 108 ? 10f 110 ? 111 1 120 ? 123 124 ? 127 128 ? 12f 130 ? 131 2 140 ? 143 144 ? 147 148 ? 14f 150 ? 151 3 160 ? 163 164 - 167 168 ? 16f 170 ? 171 4 180 ? 183 184 ? 187 188 ? 18f 190 ? 191 5 1a0 ? 1a3 1a4 ? 1a7 1a8 ? 1af 1b0 ? 1b1 6 1c0 ? 1c3 1c4 ? 1c7 1c8 ? 1cf 1d0 ? 1d1 7 1e0 ? 1e3 1e4 ? 1e7 1e8 ? 1ef 1f0 ? 1f1 8 200 ? 203 204 ? 207 208 ? 20f 210 ? 211 9 220 ? 223 224 ? 227 228 ? 22f 230 ? 231 10 240 ? 243 244 ? 247 248 ? 24f 250 ? 251 11 260 ? 263 264 ? 267 268 ? 26f 270 ? 271 12 280 ? 283 284 ? 287 288 ? 28f 290 ? 291 13 2a0 ? 2a3 2a4 ? 2a7 2a8 ? 2af 2b0 ? 2b1 14 2c0 ? 2c3 2c4 ? 2c7 2c8 ? 2cf 2d0 ? 2d1 15 2e0 ? 2e3 2e4 ? 2e7 2e8 ? 2ef 2f0 ? 2f1 mailbox-0 is a receive-only box, and all the ot her mailboxes can operate as both receive and transmit boxes, dependant upon the mbc (mailbox configuration) bits in the message control. the following diagram shows the structure of a mailbox in detail.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 680 of 1080 rej09b0230-0300 table 17.1 roles of mailboxes tx rx mb15-1 ok ok mb0 ? ok 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 rtr ide 0 0 nmc 0 0 0 0 0 0 dlc[3:0] extid[15:0] stdid[10:0] extid[17:16] mbc[2:0] msg_data_1 msg_data_3 msg_data_5 msg_data_7 msg_data_0 (first rx/tx byte) msg_data_2 msg_data_4 msg_data_6 extid_ lafm[17:16] ide_ lafm 0 0 0 rtr ide ide_ lafm 0 0 address data bus access size field name h'100 + n * 32 h'102 + n * 32 h'104 + n * 32 h'106 + n * 32 h'108 + n * 32 h'10a + n * 32 h'10c + n * 32 h'10e + n * 32 h'110 + n * 32 stdid_lafm[10:0] word/lw word word/lw word byte/word/lw byte/word byte/word/lw byte/word byte/word control 0 lafm data control 1 mb0 (reception mb) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 nmc atx dart 0 0 0 0 dlc[3:0] extid[15:0] stdid[10:0] extid[17:16] mbc[2:0] msg_data_1 msg_data_3 msg_data_5 msg_data_7 msg_data_0 (first rx/tx byte) msg_data_2 msg_data_4 msg_data_6 address data bus access size field name h'100 + n * 32 h'102 + n * 32 h'104 + n * 32 h'106 + n * 32 h'108 + n * 32 h'10a + n * 32 h'10c + n * 32 h'10e + n * 32 h'110 + n * 32 word/lw word word/lw word byte/word/lw byte/word byte/word/lw byte/word byte/word control 0 lafm data control 1 mb15-1 (mb for transmission/reception) mbc[1] is fixed to "1" extid_lafm[15:0] extid_ lafm[17:16] stdid_lafm[10:0] extid_lafm[15:0] byte: 8-bit access, word: 16-bit access, lw (lon g word): 32-bit access figure 17.3 mailbox-n structure notes: 1. all bits shadowed in grey are reserved and must be written low. the value returned by a read may not always be ?0? and should not be relied upon. 2. atx and dart are not supported by mailbox-0, and the mbc setting of mailbox-0 is limited. 3. id reorder (mcr15) can change the order of stdid, rtr, ide and extid of both message control and lafm.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 681 of 1080 rej09b0230-0300 (1) message control field stdid[10:0] : these bits set the identifier (standard identifier) of data frames and remote frames. extid[17:0] : these bits set the identifier (extended identifier) of data frames and remote frames. rtr (remote transmission request bit) : used to distinguish between data frames and remote frames. this bit is overwritten by received can frames depending on data frames or remote frames. important: please note that, when atx bit is set with the setting mbc=001(bin), the rtr bit will never be set. when a remote frame is received, the cpu can be notified by the corresponding rfpr set or irr[2] (remote frame request interrupt), however, as rcan-et needs to transmit the cu rrent message as a data frame, the rtr bit remains unchanged. important: in order to support automatic answer to remote frame when mbc=001(bin) is used and atx=1 the rtr flag must be programmed to zero to allow data frame to be transmitted. note: when a mailbox is configured to send a remote frame request the dlc used for transmission is the one stored into the mailbox. rtr description 0 data frame 1 remote frame ide (identifier extension bit) : used to distinguish between the standard format and extended format of can data frames and remote frames. ide description 0 standard format 1 extended format
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 682 of 1080 rej09b0230-0300 ? mailbox-0 bit: initial value: r/w: 151413121110987654321 0 0000011100000000 r r r/w r r r/w r/w r/w r r r r r/w r/w r/w r/w 0 0 nmc 0 0 mbc[2:0] 0 0 0 0 dlc[3:0] note: mbc[1] of mb0 is always "1". ? mailbox-15 to 1 bit: initial value: r/w: 151413121110987654321 0 0000011100000000 r r r/w r/w r/w r/w r/w r/w r r r r r/w r/w r/w r/w 0 0 nmc atx dart mbc[2:0] 0 0 0 0 dlc[3:0] nmc (new message control): when this bit is set to ?0?, the mailbox of which the rxpr or rfpr bit is already set does not store the new message but maintains the old one and sets the umsr correspondent bit. when this bit is set to ?1?, the mailbox of which the rxpr or rfpr bit is already set overwrites with the new message and sets the umsr correspondent bit. important: please note that if a remote frame is overwritten with a data frame or vice versa could be that both rxpr and rfpr flags (together with umsr) are set for the same mailbox. in this case the rtr bit within the mailbox control field should be relied upon. nmc description 0 overrun mode (initial value) 1 overwrite mode atx (automatic transmission of data frame): when this bit is set to ?1? and a remote frame is received into the mailbox dlc is stored. then, a data frame is transmitted from the same mailbox using the current contents of the message data and updated dlc by setting the corresponding txpr automatically. the scheduling of transmission is still governed by id priority or mailbox priority as configured with the message transmission priority control bit (mcr.2). in order to use this function, mbc[2:0] needs to be programmed to be ?001? (bin). when a transmission is performed by this function, the dlc (data length code) to be used is the one that has been received. ap plication needs to guarantee that the dlc of the remote frame correspond to the dlc of the data frame requested. important: when atx is used and mbc=001 (bin) the filter for the ide bit cannot be used since id of remote frame has to be exactly the same as that of data frame as the reply message.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 683 of 1080 rej09b0230-0300 important: please note that, when this function is used, the rtr bit will never be set despite receiving a remote frame. when a remote frame is received, the cpu will be notified by the corresponding rfpr set, however, as rcan-et need s to transmit the current message as a data frame, the rtr bit remains unchanged. important: please note that in case of overrun condition (umsr flag set when the mailbox has its nmc = 0) the message received is discarded. in case a remote frame is causing overrun into a mailbox configured with atx = 1, the transmission of the corresponding data frame may be triggered only if the related rfpr flag is cleared by the cpu when the umsr flag is set. in such case rfpr flag would get set again. atx description 0 automatic transmission of data frame disabled (initial value) 1 automatic transmission of data frame enabled dart (disable automatic re-transmission): when this bit is set, it disables the automatic re- transmission of a message in the event of an er ror on the can bus or an arbitration lost on the can bus. in effect, when this function is used, th e corresponding txcr bit is automatically set at the start of transmission. when this bit is set to ?0?, rcan-et tries to transmit the message as many times as required until it is successfully transmitted or it is cancelled by the txcr. dart description 0 re-transmission enabled (initial value) 1 re-transmission disabled mbc[2:0] (mailbox configuration): these bits configure the nature of each mailbox as follows. when mbc=111 (bin), the mailbox is inactive, i. e., it does not receive or transmit a message regardless of txpr or other settings. the mbc= ?110?, ?101? and ?100? settings are prohibited. when the mbc is set to any other value, the lafm field becomes available. please don't set txpr when mbc is set as reception. there is no hardware protection, and txpr remains set. mbc[1] of mailbox-0 is fixed to "1" by hardware. this is to ensure that mb0 cannot be configured to transmit messages.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 684 of 1080 rej09b0230-0300 mbc[2] mbc[1] mbc[0] data frame transmit remote frame transmit data frame receive remote frame receive remarks 0 0 0 yes yes no no ? not allowed for mailbox-0 0 0 1 yes yes no yes ? can be used with atx * ? not allowed for mailbox-0 ? lafm can be used 0 1 0 no no yes yes ? allowed for mailbox-0 ? lafm can be used 0 1 1 no no yes no ? allowed for mailbox-0 ? lafm can be used 1 0 0 setting prohibited 1 0 1 setting prohibited 1 1 0 setting prohibited 1 1 1 mailbox inactive (initial value) notes: * in order to support automatic retransmission, rtr shall be "0" when mbc=001(bin) and atx=1. when atx=1 is used the filter for ide must not be used dlc[3:0] (data length code): these bits encode the number of data bytes from 0,1, 2, ? 8 that will be transmitted in a data frame. please note that when a remote frame request is transmitted the dlc value to be used must be the same as the dlc of the data frame that is requested. dlc[3] dlc[2] dlc[1] dlc[0] description 0 0 0 0 data length = 0 bytes (initial value) 0 0 0 1 data length = 1 byte 0 0 1 0 data length = 2 bytes 0 0 1 1 data length = 3 bytes 0 1 0 0 data length = 4 bytes 0 1 0 1 data length = 5 bytes 0 1 1 0 data length = 6 bytes 0 1 1 1 data length = 7 bytes 1 x x x data length = 8 bytes
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 685 of 1080 rej09b0230-0300 (2) local acceptance filter mask (lafm) this area is used as local acceptan ce filter mask (lafm) for receive boxes . lafm: when mbc is set to 001, 010, 011 (bin), this field is used as lafm field. it allows a mailbox to accept more than one id entifier. the lafm is compri sed of two 16-bit read/write areas as follows. word/lw word h'104 + n * 32 h'106 + n * 32 lafm field 151413121110987654321 0 extid_ lafm[17:16] ide_ lafm 0 0 stdid_lafm[10:0] extid_lafm[15:0] figure 17.4 acceptance filter if a bit is set in the lafm, then the corresponding bit of a received can identifier is ignored when the rcan-et searches a mailbox with the matching can identifier. if the bit is cleared, then the corresponding bit of a received can iden tifier must match to the stdid/ide/extid set in the mailbox to be stored. the structure of the lafm is same as the message control in a mailbox. if this function is not required, it must be filled with ?0?. important: rcan-et starts to find a matching identifier from mailbox-15 down to mailbox-0. as soon as rcan-et finds one matching, it stops th e search. the message will be stored or not depending on the nmc and rxpr/rfpr flags. th is means that, even us ing lafm, a received message can only be stored into 1 mailbox. important: when a message is received and a matching mailbox is found, the whole message is stored into the mailbox. this means that, if the lafm is used, the stdid, rtr, ide and extid may differ to the ones originally set as they are updated with the stdid, rtr, ide and extid of the received message. std_lafm[10:0] ? filter mask bits for the can base identifier [10:0] bits. std_lafm[10:0] description 0 corresponding std_id bit is cared 1 corresponding std_id bit is "don't cared"
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 686 of 1080 rej09b0230-0300 ext_lafm[17:0] ? filter mask bits for the can extended identifier [17:0] bits. ext_lafm[17:0] description 0 corresponding ext_id bit is cared 1 corresponding ext_id bit is "don't cared" ide_lafm ? filter mask bit for the can ide bit. ide_lafm description 0 corresponding ide_id bit is cared 1 corresponding ide_id bit is "don't cared" (3) message data fields storage for the can message data that is tran smitted or received. msg_data[0] corresponds to the first data byte that is transmitted or received. the bit order on the can bus is bit 7 through to bit 0.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 687 of 1080 rej09b0230-0300 17.3.3 rcan-et control registers the following sections describe rcan-et control registers. the address is mapped as follow. important: these registers can only be accessed in word size (16-bit). description address name access size (bits) master control register 000 mcr word general status register 002 gsr word bit configuration register 1 004 bcr1 word bit configuration register 0 006 bcr0 word interrupt request register 008 irr word interrupt mask register 00a imr word error counter register 00c tec/rec word figure 17.5 rcan-et control registers (1) master control register (mcr) the master control register (mcr) is a 16-bit read/write register that controls rcan-et. ? mcr (address = h'000) bit: initial value: r/w: 151413121110987654321 0 1000000000000001 r/w r/w r r r r/w r/w r/w r/w r/w r/w r r r/w r/w r/w mcr15 mcr14 - - - tst[2:0] mcr7 mcr6 mcr5 - - mcr2 mcr1 mcr0 bit 15 ? id reorder (mcr15): this bit changes the order of stdid, rtr, ide and extid of both message control and lafm. bit15 : mcr15 description 0 rcan-et is the same as hcan2 1 rcan-et is not the same as hcan2 (initial value)
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 688 of 1080 rej09b0230-0300 0 stdid[10:0] extid[15:0] rtr ide extid[17:16] word/lw word h'100 + n * 32 h'102 + n * 32 control 0 151413121110987654321 0 0 stdid_lafm[10:0] extid_lafm[15:0] 0 ide_ lafm extid_lafm [17:16] word/lw word h'104 + n * 32 h'106 + n * 32 lafm field 0 stdid[10:0] extid[15:0] rtr ide extid[17:16] word/lw word h'100 + n * 32 h'102 + n * 32 control 0 151413121110987654321 0 0 stdid_lafm[10:0] extid_lafm[15:0] extid_lafm [17:16] word/lw word h'104 + n * 32 h'106 + n * 32 lafm field 0 ide_ lafm mcr15 (id reorder) = 0 mcr15 (id reorder) = 1 figure 17.6 id reorder this bit can be modified only in reset mode. bit 14 ? auto halt bus off (mcr14): if both this bit and mcr6 are set, mcr1 is automatically set as soon as rcan-et enters busoff. bit14 : mcr14 description 0 rcan-et remains in busoff for normal recovery sequence (128 x 11 recessive bits) (initial value) 1 rcan-et moves directly into halt mode after it enters busoff if mcr6 is set. this bit can be modified only in reset mode. bit 13 ? reserved . the written value should always be '0' and the returned value is '0'. bit 12 ? reserved . the written value should always be '0' and the returned value is '0'. bit 11 ? reserved . the written value should always be '0' and the returned value is '0'. bit 10 - 8 ? test mode (tst[2:0]): this bit enables/disables th e test modes. please note that before activating the test mode it is requested to move rcan-et into halt mode or reset mode. this is to avoid that the transition to test mode could affect a transmi ssion/reception in progress. for details, please refer to section 17.4.1, test mode settings. please note that the test modes are allowed only for diagnosis and tests and not when rcan-et is used in normal operation.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 689 of 1080 rej09b0230-0300 bit10: tst2 bit9: tst1 bit8: tst0 description 0 0 0 normal mode (initial value) 0 0 1 listen-only mode (receive-only mode) 0 1 0 self test mode 1 (external) 0 1 1 self test mode 2 (internal) 1 0 0 write error counter 1 0 1 error passive mode 1 1 0 setting prohibited 1 1 1 setting prohibited bit 7 ? auto-wake mode (mcr7): mcr7 enables or disables the auto-wake mode. if this bit is set, the rcan-et automatically cancels the sleep mode (mcr5) by detecting can bus activity (dominant bit). if mcr7 is cleared the rcan-et does not automatically cancel the sleep mode. rcan-et cannot store the message that wakes it up. note: mcr7 cannot be modified while in sleep mode. bit7 : mcr7 description 0 auto-wake by can bus activity disabled (initial value) 1 auto-wake by can bus activity enabled bit 6 ? halt during bus off (mcr6): mcr6 enables or disables entering halt mode immediately when mcr1 is set during bus off. this bit can be modified only in reset or halt mode. please note that when halt is entered in bus off the can engine is also recovering immediately to error active mode. bit6 : mcr6 description 0 if mcr[1] is set, rcan-et will not enter halt mode during bus off but wait up to end of recovery sequence (initial value) 1 enter halt mode immediately during bus off if mcr[1] or mcr[14] are asserted.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 690 of 1080 rej09b0230-0300 bit 5 ? sleep mode (mcr5): enables or disables sleep mode transition. if this bit is set, while rcan-et is in halt mode, the transition to sleep mode is enabled. setting mcr5 is allowed after entering halt mode. the two error counters (rec, tec) will remain the same during sleep mode. this mode will be exited in two ways: 1. by writing a '0' to this bit position, 2. or, if mcr[7] is enabled, after detecting a dominant bit on the can bus. if auto wake up mode is disabled, rcan-et w ill ignore all can bus activities until the sleep mode is terminated. when leaving this mode the rcan-et will synchronise to the can bus (by checking for 11 recessive bits) before joining can bus activity. this means that, when the no.2 method is used, rcan-et will miss the first messa ge to receive. can transceivers stand-by mode will also be unable to cope with the first message when exiting stand by mode, and the s/w needs to be designed in this manner. in sleep mode only the following registers can be accessed: mcr, gsr, irr and imr. important: rcan-et is required to be in halt mode before requesting to enter in sleep mode. that allows the cpu to clear all pending interrupts before entering sleep mode. once all interrupts are cleared rcan-et must leave the halt mode and enter sleep mode simultaneously (by writing mcr[5]=1 and mcr[1]=0 at the same time). bit 5 : mcr5 description 0 rcan-et sleep mode released (initial value) 1 transition to rcan-et sleep mode enabled bit 4 ? reserved . the written value should always be '0' and the returned value is '0'. bit 3 ? reserved . the written value should always be '0' and the returned value is '0'. bit 2 ? message transmission priority (mcr2): mcr2 selects the order of transmission for pending transmit data. if this bit is set, pending transmit data are sent in order of the bit position in the transmission pending register (txpr). the order of transmission starts from mailbox-15 as the highest priority, and then down to mailbox-1 (if those mailboxes are configured for transmission).
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 691 of 1080 rej09b0230-0300 if mcr2 is cleared, all messages for transmission are queued with respect to their priority (by running internal arbitration). the highest priority message has the arbitration field (stdid + ide bit + extid (if ide=1) + rtr bit) with the lowest digital value and is transmitted first. the internal arbitration includes the rtr bit and the ide bit (internal arbitration works in the same way as the arbitration on the can bus between two can nodes starting transmission at the same time). this bit can be modified only in reset or halt mode. bit 2 : mcr2 description 0 transmission order determined by message identifier priority (initial value) 1 transmission order determined by ma ilbox number priority (mailbox-15 mailbox-1) bit 1?halt request (mcr1): setting the mcr1 bit causes the can controller to complete its current operation and then enter halt mode (whe re it is cut off from the can bus). the rcan-et remains in halt mode until the mcr1 is cleared. during the halt mode, the can interface does not join the can bus activity and does not store messages or transmit messages. all the user registers (including mailbox contents and tec/r ec) remain unchanged with the exception of irr0 and gsr4 which are used to notify the halt status itself. if the can bus is in idle or intermission state regardless of mcr6, rcan-et will enter halt mode within one bit time. if mcr6 is set, a halt request during bus off will be also processed within one bit time. otherwise the full bus off recovery sequence will be performed beforehand. entering the halt mode can be notified by irr0 and gsr4. if both mcr14 and mcr6 are set, mcr1 is automatically set as soon as rcan-et enters busoff. in the halt mode, the rcan-et configuration can be modified with the exception of the bit timing setting, as it does not join the bus activity. mcr[1] has to be cleared by writing a ?0? in order to re-join the can bus. after this bit has been cleared, rcan-et waits until it detects 11 recessive bits, and then joins the can bus. note: after issuing a halt request the cpu is not allowed to set txpr or txcr or clear mcr1 until the transition to halt mode is completed (notified by irr0 and gsr4). after mcr1 is set this can be cleared only after entering halt mode or through a reset operation (sw or hw). note: transition into or recovery from halt mode, is only possible if the bcr1 and bcr0 registers are configured to a proper baud rate.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 692 of 1080 rej09b0230-0300 bit 1 : mcr1 description 0 clear halt request (initial value) 1 halt mode transition request bit 0 ? reset request (mcr0): controls resetting of the rcan-et module. when this bit is changed from ?0? to ?1? the rcan-et controller enters its reset routine, re-initialising the internal logic, which then sets gsr3 and irr0 to notify the reset mode. during a re-initialisation, all user registers are initialised. rcan-et can be re-configured while this bit is set. this bit has to be cleared by writing a ?0? to join the can bus. after this bit is clear ed, the rcan-et module waits until it detects 11 recessive bits, and then joins the can bus. the baud rate needs to be set up to a proper value in order to sample the value on the can bus. after power on reset, this bit and gsr3 are always set. this means that a reset request has been made and rcan-et needs to be configured. the reset request is equivalent to a power on reset but controlled by software. bit 0 : mcr0 description 0 clear reset request 1 can interface reset mode transition request (initial value)
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 693 of 1080 rej09b0230-0300 (2) general status register (gsr) the general status register (gsr) is a 16-bit r ead-only register that i ndicates the status of rcan-et. ? gsr (address = h'002) bit: initial value: r/w: 151413121110987654321 0 0000000000001100 rrrrrrrrrrrrrrrr - - - - - - - - - - gsr5 gsr4 gsr3 gsr2 gsr1 gsr0 bits 15 to 6: reserved . the written value should always be '0 ' and the returned value is '0'. bit 5 ? error passive status bit (gsr5): indicates whether the can interface is in error passive or not. this bit will be set high as soon as the rcan-et enters the error passive state and is cleared when the module enters again the error active state (thi s means the gsr5 will stay high during error passive and during bus off). consequently to find out the correct state both gsr5 and gsr0 must be considered. bit 5 : gsr5 description 0 rcan-et is not in error passive or in bus off status (initial value) [reset condition] rcan-et is in error active state 1 rcan-et is in error passive (if gsr0=0) or bus off (if gsr0=1) [setting condition] when tec 128 or rec 128 or if error passive test mode is selected bit 4 ? halt/sleep status bit (gsr4): indicates whether the can e ngine is in the halt/sleep state or not. please note that the clearing time of this flag is not the same as the setting time of irr12. please note that this flag reflects the status of the can engine and not of the full rcan-et ip. rcan-et exits sleep mode and can be accessed on ce mcr5 is cleared. the can engine exits sleep mode only after two additional transmission clocks on the can bus. bit 4 : gsr4 description 0 rcan-et is not in the halt state or sleep state (initial value) 1 halt mode (if mcr1=1) or sleep mode (if mcr5=1) [setting condition] if mcr1 is set and the can bus is either in intermission or idle or mcr5 is set and rcan-et is in the halt mode or rcan-et is moving to bus off when mcr14 and mcr6 are both set
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 694 of 1080 rej09b0230-0300 bit 3 ? reset status bit (gsr3): indicates whether the rcan-et is in the reset state or not. bit 3 : gsr3 description 0 rcan-et is not in the reset state 1 reset state (initial value) [setting condition] after an rcan-et internal reset (due to sw or hw reset) bit 2 ? message transmission in progress flag (gsr2): flag that indicates to the cpu if the rcan-et is in bus off or transmitting a message or an error/overload flag due to error detected during transmission. the timing to set txack is different from the time to clear gsr2. txack is set at the 7 th bit of end of frame. gsr2 is set at the 3 rd bit of intermission if there are no more messages ready to be transmitted. it is also set by arbitration lost, bus idle, reception, reset or halt transition. bit 2 : gsr2 description 0 rcan-et is in bus off or a transmission is in progress 1 [setting condition] not in bus off and no transmission in progress (initial value) bit 1?transmit/receive warning flag (gsr1): flag that indicates an error warning. bit 1 : gsr1 description 0 [reset condition] when (tec < 96 and rec < 96) or bus off (initial value) 1 [setting condition] when 96 tec < 256 or 96 rec < 256 note: rec is incremented during bus off to co unt the recurrences of 11 recessive bits as requested by the bus off recovery sequence. however the flag gsr1 is not set in bus off. bit 0?bus off flag (gsr0): flag that indicates that rca n-et is in the bus off state. bit 0 : gsr0 description 0 [reset condition] recovery from bus off state or after a hw or sw reset (initial value) 1 [setting condition] when tec 256 (bus off state) note: only the lower 8 b its of tec are accessible from the user interface. the 9 th bit is equivalent to gsr0.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 695 of 1080 rej09b0230-0300 (3) bit configuration register (bcr0, bcr1) the bit configuration registers (bcr0 and bcr1) ar e 2 x 16-bit read/write register that are used to set can bit timing parameters and the ba ud rate pre-scaler for the can interface. the time quanta is defined as: timequanta = 2 * brp f clk where: brp (baud rate pre-scaler) is the value st ored in bcr0 incremented by 1 and fclk is the used peripheral bus frequency. ? bcr1 (address = h'004) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r r/w r/w r/w r r r/w r/w r r r r/w tsg1[3:0] - tsg2[2:0] - - sjw[1:0] - - - bsp please refer to the table on sec tion 0 for tsg1 and tsg2 setting. bits 15 to 12 ? time segment 1 (tsg1[3:0] = bcr1[15:12]): these bits are used to set the segment tseg1 (= prseg + phseg1) to compensate for edges on the can bus with a positive phase error. a value from 4 to 16 time quanta can be set. bit 15: tsg1[3] bit 14: tsg1[2] bit 13: tsg1[1] bit 12: tsg1[0] description 0 0 0 0 setting prohibited (initial value) 0 0 0 1 setting prohibited 0 0 1 0 setting prohibited 0 0 1 1 prseg + phseg1 = 4 time quanta 0 1 0 0 prseg + phseg1 = 5 time quanta : : : : : : : : : : 1 1 1 1 prseg + phseg1 = 16 time quanta bit 11 : reserved . the written value should always be '0' and the returned value is '0'.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 696 of 1080 rej09b0230-0300 bits 10 to 8 ? time segment 2 (tsg2[2:0] = bcr1[10:8]): these bits are used to set the segment tseg2 (=phseg2) to compensate for edges on the can bus with a negative phase error. a value from 2 to 8 time quanta can be set as shown below. bit 10: tsg2[2] bit 9: tsg2[1] bit 8: tsg2[0] description 0 0 0 setting prohibited (initial value) 0 0 1 phseg2 = 2 time quanta (conditionally prohibited) see sec. 0 0 1 0 phseg2 = 3 time quanta 0 1 1 phseg2 = 4 time quanta 1 0 0 phseg2 = 5 time quanta 1 0 1 phseg2 = 6 time quanta 1 1 0 phseg2 = 7 time quanta 1 1 1 phseg2 = 8 time quanta bits 7 and 6 : reserved . the written value should always be '0 ' and the returned value is '0'. bits 5 and 4 - resynchronisation jump width (sjw[1:0] = bcr0[5:4]): these bits set the synchronisation jump width. bit 5: sjw[1] bit 4: sjw[0] description 0 0 synchronisation jump width = 1 time quantum (initial value) 0 1 synchronisation jump width = 2 time quanta 1 0 synchronisation jump width = 3 time quanta 1 1 synchronisation jump width = 4 time quanta bits 3 to 1 : reserved . the written value should always be '0' and the returned value is '0'. bit 0 ? bit sample point (bsp = bcr1[0]): sets the point at which data is sampled. bit 0 : bsp description 0 bit sampling at one point (end of time segment 1) (initial value) 1 bit sampling at three points (rising edge of the last three clock cycles of phseg1)
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 697 of 1080 rej09b0230-0300 ? bcr0 (address = h'006) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrr/wr/wr/wr/wr/wr/wr/wr/w - - - - - - - - brp[7:0] bits 8 to 15 : reserved . the written value should always be '0 ' and the returned value is '0'. bits 7 to 0?baud rate pre-scale (brp[7:0] = bcr0 [7:0]): these bits are used to define the peripheral bus clock periods contained in a time quantum. bit 7: brp[7] bit 6: brp[6] bit 5: brp[5] bit 4: brp[4] bit 3: brp[3] bit 2: brp[2] bit 1: brp[1] bit 0: brp[0] description 0 0 0 0 0 0 0 0 2 x peripheral bus clock (initial value) 0 0 0 0 0 0 0 1 4 x peripheral bus clock 0 0 0 0 0 0 1 0 6 x peripheral bus clock : : : : : : : : : : : : : : : : 2 * (register value+1) x peripheral bus clock 1 1 1 1 1 1 1 1 512 x peripheral bus clock ? requirements of bit configuration register 1-bit time (8-25 quanta) sync_seg prseg phseg1 tseg1 1 4-16 2-8 tseg2 phseg2 quantum sync_seg: segment for establishing synchronisation of nodes on the can bus. (normal bit edge transitions occur in this segment.) prseg: segment for compensating for physical delay between networks. phseg1: buffer segment for correcting phase drift (positive). (this segment is extended when synchronisation (resynchronisation) is established.) phseg2: buffer segment for correcting phase drift (negative). (this segment is shortened when synchronisation (resynchronisation) is established) tseg1: tsg1 + 1
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 698 of 1080 rej09b0230-0300 tseg2: tsg2 + 1 the rcan-et bit rate calculation is: bit rate = f clk 2 * (brp + 1) * (tseg1 + tseg2 + 1) where brp is given by the register value and tseg1 and tseg2 are derived values from tsg1 and tsg2 register values. the ?+ 1? in the above formula is for the sync-seg which duration is 1 time quanta. f clk = peripheral clock bcr setting constraints tseg1min > tseg2 sjwmax (sjw = 1 to 4) 8 tseg1 + tseg2 + 1 25 time quanta (tseg1 + tseg2 + 1 = 7 is not allowed) tseg2 2 these constraints allow the setting range shown in the table below for tseg1 and tseg2 in the bit configuration register. the number in the table shows possible setting of sjw. "no" shows that there is no allowed combination of tseg1 and tseg2.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 699 of 1080 rej09b0230-0300 001 010 011 100 101 110 111 tsg2 2 3 4 5 6 7 8 tseg2 tsg1 tseg1 0011 4 no 1-3 no no no no no 0100 5 1-2 1-3 1-4 no no no no 0101 6 1-2 1-3 1-4 1-4 no no no 0110 7 1-2 1-3 1-4 1-4 1-4 no no 0111 8 1-2 1-3 1-4 1-4 1-4 1-4 no 1000 9 1-2 1-3 1-4 1-4 1-4 1-4 1-4 1001 10 1-2 1-3 1-4 1-4 1-4 1-4 1-4 1010 11 1-2 1-3 1-4 1-4 1-4 1-4 1-4 1011 12 1-2 1-3 1-4 1-4 1-4 1-4 1-4 1100 13 1-2 1-3 1-4 1-4 1-4 1-4 1-4 1101 14 1-2 1-3 1-4 1-4 1-4 1-4 1-4 1110 15 1-2 1-3 1-4 1-4 1-4 1-4 1-4 1111 16 1-2 1-3 1-4 1-4 1-4 1-4 1-4 example 1: to have a bit rate of 500 kbps with a frequency of fclk = 40 mhz it is possible to set: brp = 43, tseg1 = 6, tseg2 = 3. then the configuration to write is bcr1 = 5200 and bcr0 = 0003. example 2: to have a bit rate of 250 kps with a frequency of 35 mhz it is possible to set: bpr = 4, tseg1 = 8, tseg2 = 5. then the configuration to write is bcr1 = 7400 and bcr0 = 0004.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 700 of 1080 rej09b0230-0300 (4) interrupt request register (irr) the interrupt register (irr) is a 16-bit read/write-c learable register contai ning status flags for the various interrupt sources. ? irr (address = h'008) bit: initial value: r/w: 151413121110987654321 0 0000000000000001 r r r/w r/w r r r r r/w r/w r/w r/w r/w r r r/w - - irr13 irr12 - - irr9 irr8 irr7 irr6 irr5 irr4 irr3 irr2 irr1 irr0 bits 15 to 14: reserved. bit 13 - message error interrupt (irr13): this interrupt indicates that: ? a message error has occurred when in test mode. ? note: if a message overload condition occurs when in test mode, then this bit will not be set. when not in test mode this interrupt is inactive. bit 13: irr13 description 0 message error has not occurred in test mode (initial value) [clearing condition] writing 1 1 [setting condition] message error has occurred in test mode bit 12 ? bus activity while in sleep mode (irr12): irr12 indicates that a can bus activity is present. while the rcan-et is in sleep mode and a dominant bit is detected on the can bus, this bit is set. this interrupt is cleared by writing a '1' to this bit position. writing a '0' has no effect. if auto wakeup is not used and this interrupt is not requested it needs to be disabled by the related interrupt mask register. if auto wake up is not used and this interrupt is requested it should be cleared only after recovering from sleep mode. this is to avoid that a new falling edge of the reception line causes the inte rrupt to get set again. please note that the setting time of this interrupt is different from the clearing time of gsr4. bit 12: irr12 description 0 bus idle state (initial value) [clearing condition] writing 1 1 [setting condition] dominant bit level detection on the rx line while in sleep mode
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 701 of 1080 rej09b0230-0300 bits 11 to 10: reserved bit 9 ? message overrun/overwrite interrupt flag (irr9): flag indicating that a message has been received but the existing message in th e matching mailbox has not been read as the corresponding rxpr or rfpr is already set to ?1 ? and not yet cleared by the cpu. the received message is either abandoned (overrun) or overwritten dependant upon the nmc (new message control) bit. this bit is cleared when all bit in umsr (unread message status register) are cleared (by writing ?1?) or by setting mbimr (mailbox interrupt mast register) for all umsr flag set . it is also cleared by writing a '1' to all the correspondent bit position in mbimr. writing to this bit position has no effect. bit 9: irr9 description 0 no pending notification of message overrun/overwrite [clearing condition] clearing of all bit in umsr/setting mbimr for all umsr set (initial value) 1 a receive message has been discarded due to overrun condition or a message has been overwritten [setting condition] message is received while the corresponding rxpr and/or rfpr =1 and mbimr =0 bit 8 - mailbox empty interrupt flag (irr8): this bit is set when one of the messages set for transmission has been successfully sent (corresponding txack flag is set) or has been successfully aborted (corresponding aback flag is set). the related txpr is also cleared and this mailbox is now ready to accept a new message da ta for the next transmission. in effect, this bit is set by an or?ed signal of the txack and aback bits not masked by the corresponding mbimr flag. therefore, this bit is automatica lly cleared when all th e txack and aback bits are cleared. it is also cleared by writing a '1 ' to all the correspondent bit position in mbimr. writing to this bit position has no effect. bit 8: irr8 description 0 messages set for transmission or transmission cancellation request not progressed. (initial value) [clearing condition] all the txac k and aback bits are cleared/setting mbimr for all txack and aback set 1 message has been transmitted or aborted, and new message can be stored [setting condition] when one of the txpr bits is cleared by completion of transmission or completion of transmission abort, i.e., when a txack or aback bit is set (if mbimr=0).
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 702 of 1080 rej09b0230-0300 bit 7 - overload frame (irr7): flag indicating that the rcan- et has detected a condition that should initiate the transmission of an overload fr ame. note that on the condition of transmission being prevented, such as listen only mode, an overload frame will not be transmitted, but irr7 will still be set. irr7 remains asserted until reset by writing a '1' to this bit position - writing a '0' has no effect. bit 7: irr7 description 0 [clearing condition] writing 1 (initial value) 1 [setting conditions] overload condition detected bit 6 - bus off interrupt flag (irr6): this bit is set when rcan-et enters the bus-off state or when rcan-et leaves bus-off and returns to erro r-active. the cause ther efore is the existing condition tec 256 at the node or the end of the bus-off recovery sequence (128x11 consecutive recessive bits) or the transition from bus off to halt (automatic or manual). this bit remains set even if the rcan-et node leaves the bus-off condition, and needs to be explicitly cleared by s/w. the s/w is expected to read the gsr0 to judge whether rcan-et is in the bus- off or error active status. it is cleared by writing a '1' to this bit position even if the node is still bus-off. writing a '0' has no effect. bit 6: irr6 description 0 [clearing condition] writing 1 (initial value) 1 enter bus off state caused by transmit error or error active state returning from bus-off [setting condition] when tec becomes 256 or end of bus-off after 128x11 consecutive recessive bits or transition from bus off to halt bit 5 - error passive interrupt flag (irr5): interrupt flag indicating the error passive state caused by the transmit or receive error counter or by error passive forced by test mode. this bit is reset by writing a '1' to this bit position, writing a '0' has no effect. if this bit is cleared the node may still be error passive. please note that the sw needs to check gsr0 and gsr5 to judge whether rcan-et is in error passive or bus off status. bit 5: irr5 description 0 [clearing condition] writing 1 (initial value) 1 error passive state caused by transmit/receive error [setting condition] when tec 128 or rec 128 or error passive test mode is used
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 703 of 1080 rej09b0230-0300 bit 4 - receive error counter warning interrupt flag (irr4): this bit becomes set if the receive error counter (rec) reaches a value great er than 95 when rcan-et is not in the bus off status. the interrupt is reset by writing a '1' to this bit position, writing '0' has no effect. bit 4: irr4 description 0 [clearing condition] writing 1 (initial value) 1 error warning state caused by receive error [setting condition] when rec 96 and rcan-et is not in bus off bit 3 - transmit error counter warning interrupt flag (irr3): this bit becomes set if the transmit error counter (tec) reaches a value greater than 95. the interrupt is reset by writing a '1' to this bit position, writing '0' has no effect. bit 3: irr3 description 0 [clearing condition] writing 1 (initial value) 1 error warning state caused by transmit error [setting condition] when tec 96 bit 2 - remote frame request interrupt flag (irr2): flag indicating that a remote frame has been received in a mailbox. this b it is set if at least one receive mailbox, with related mbimr not set, contains a remote frame transmission request. this bit is automatically cleared when all bits in the remote frame receive pending register (rfpr), are cleared. it is also cleared by writing a '1' to all the correspondent bit position in mb imr. writing to this bit has no effect. bit 2: irr2 description 0 [clearing condition] clearing of all bits in rfpr (initial value) 1 at least one remote request is pending [setting condition] when remote frame is received and the corresponding mbimr = 0 bit 1 ? data frame received interrupt flag (irr1): irr1 indicates that there are pending data frames received. if this bit is set at least one receive mailbox contains a pending message. this bit is cleared when all bits in the data frame receive pending regi ster (rxpr) are cleared, i.e. there is no pending message in any receiving mailbox. it is in effect a logical or of the rxpr flags from each configured receive mailbox with related mb imr not set. it is also cleared by writing a '1' to all the correspondent bit position in mbimr. writing to this bit has no effect.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 704 of 1080 rej09b0230-0300 bit 1: irr1 description 0 [clearing condition] clearing of all bits in rxpr (initial value) 1 data frame received and stored in mailbox [setting condition] when data is received and the corresponding mbimr = 0 bit 0 ? reset/halt/sleep interrupt flag (irr0): this flag can get set for three different reasons. it can indicate that: 1. reset mode has been entered after a sw (mcr0) or hw reset 2. halt mode has been entered after a halt request (mcr1) 3. sleep mode has been entered after a sleep request (mcr5) has been made while in halt mode. the gsr may be read after this bit is set to determine which state rcan-et is in. important : when a sleep mode request needs to be made, the halt mode must be used beforehand. please refer to the m cr5 description and figure 17.9. irr0 is set by the transition from "0" to "1" of gsr3 or gsr4 or by transition from halt mode to sleep mode. so, irr0 is not set if rcan-et enters halt mode again right after exiting from halt mode, without gsr4 being cleared. similarly, irr0 is not set by direct transition from sleep mode to halt request. at the transition from ha lt/sleep mode to trans ition/reception, clearing gsr4 needs (one-bit time - tseg2) to (one-bit time * 2 - tseg2). in the case of reset mode, irr0 is set, however, the interrupt to the cpu is not asserted since imr0 is automatically set by initialisation. bit 0: irr0 description 0 [clearing condition] writing 1 1 transition to s/w reset mode or transition to halt mode or transition to sleep mode (initial value) [setting condition] when reset/halt/sleep transition is completed after a reset (mcr0 or hw) or halt mode (mcr1) or sleep mode (mcr5) is requested
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 705 of 1080 rej09b0230-0300 (5) interrupt mask register (imr) the interrupt mask register is a 16 bit register that protects all corresponding interrupts in the interrupt request register (irr) from generating an output signal on the irq. an interrupt request is masked if the corresponding bit position is set to '1'. this register can be read or written at any time. the imr directly controls the generation of irq, but does not prevent the setting of the corresponding bit in the irr. ? imr (address = h'00a) bit: initial value: r/w: 151413121110987654321 0 1111111111111111 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w imr15 imr14 imr13 imr12 imr11 imr10 imr9 imr8 imr7 imr6 imr5 imr4 imr3 imr2 imr1 imr0 bit 15 to 0: maskable interrupt sources corresponding to irr[15:0] respectively. when a bit is set, the interrupt signal is not generated, although setting the corresponding irr bit is still performed. bit[15:0]: imrn description 0 corresponding irr is not masked (irq is generated for interrupt conditions) 1 corresponding interrupt of irr is masked (initial value) (6) transmit error counter (tec) a nd receive error counter (rec) the transmit error counter (tec) and receive er ror counter (rec) is a 16-bit read/(write) register that functions as a counter indicating the number of transmit/receive message errors on the can interface. the count value is stipulated in th e can protocol specificati on refs. [1], [2], [3] and [4]. when not in (write error counter) test mode this register is read only, and can only be modified by the can interface. this register can be cleared by a reset request (mcr0) or entering to bus off. in write error counter test mode (i.e. tst[2:0] = 3'b100), it is possible to write to this register. the same value can only be written to tec/rec, and the value written into tec is set to tec and rec. when writing to this register, rcan-et needs to be put into halt mode. this feature is only intended for test purposes.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 706 of 1080 rej09b0230-0300 ? tec/rec (address = h'00c) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * tec7 tec6 tec5 tec4 tec3 tec2 tec1 tec0 rec7 rec6 rec5 rec4 rec3 rec2 rec1 rec0 note: * it is only possible to write the value in test mode when tst[2:0] in mcr is 3'b100. rec is incremented during bus off to count the recurrences of 11 recessive bits as requested by the bus off recovery sequence. 17.3.4 rcan-et mailbox registers the following sections describe rcan-et mailbox registers that control / flag individual mailboxes. the address is mapped as follows. important : longword access is carried out as two consecutive word accesses.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 707 of 1080 rej09b0230-0300 description address name access size (bits) transmit pending 1 h'020 txpr1 lw transmit pending 0 h'022 txpr0 ? h'024 h'026 h'028 transmit cancel 0 h'02a txcr0 h'02c h'02e h'030 transmit acknowledge 0 h'032 txack0 word h'034 h'036 h'038 abort acknowledge 0 h'03a aback0 word h'03c h'03e h'040 data frame receive pending 0 h'042 rxpr0 word h'044 h'046 h'048 remote frame receive pending 0 h'04a rfpr0 word h'04c h'04e h'050 mailbox interrupt mask register 0 h'052 mbimr0 word h'054 h'056 h'058 unread message status register 0 h'05a umsr0 word h'05c h'05e figure 17.7 rcan-et mailbox registers
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 708 of 1080 rej09b0230-0300 (1) transmit pending register (txpr1, txpr0) the concatenation of txpr1 and txpr0 is a 32-bit register that contains any transmit pending flags for the can module. in the case of 16-bit bu s interface, long word access is carried out as two consecutive word accesses. temp txpr1 txpr0 h'020 h'022 16-bit peripheral bus data is stored into temp instead of txpr1. consecutive access 16-bit peripheral bus lower word data are stored into txpr0. txpr1 is always h'0000. temp txpr1 txpr0 h'020 h'022 temp txpr1 txpr0 h'020 h'022 16-bit peripheral bus txpr0 is stored into temp, when txpr1 (= h'0000) is read. consecutive access 16-bit peripheral bus temp is read instead of txpr0. temp txpr1 txpr0 h'020 h'022 always h'0000 the txpr1 register cannot be modified and it is always fixed to ?0?. the txpr0 controls mailbox-15 to mailbox-1. the cpu may set the txpr bits to affect any message being considered for transmission by writing a '1' to the corresponding bit location. writing a '0' has no effect, and txpr cannot be cleared by writi ng a ?0? and must be cleared by setting the corresponding txcr bits. txpr may be read by the cpu to determine which, if any, transmissions are pending or in progress. in effect there is a transmit pending bit for all mailboxes except for the mailbox-0. writing a '1' to a bit location when the mailbox is not configured to transmit is not allowed.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 709 of 1080 rej09b0230-0300 the rcan-et will clear a transmit pending flag after successful transmission of its corresponding message or when a transmission abort is requested successfully from the txcr. the txpr flag is not cleared if the message is not transmitted due to the can node losing the arbitration process or due to errors on the can bus, and rcan-et automatically tries to transmit it again unless its dart bit (disable automatic re-transmission) is set in the message-control of the corresponding mailbox. in such case (dart set), the transmission is cleared and notified through mailbox empty interrupt flag (irr8) and the correspondent bit within the abort acknowledgement register (aback). if the status of the txpr changes, the rcan-et shall ensure that in the identifier priority scheme (mcr2=0), the highest priority message is always presented for transmission in an intelligent way even under circumstances such as bus arbitration losses or errors on the can bus. please refer to section 17.4, application note. when the rcan-et changes the state of any txpr bit position to a '0', an empty slot interrupt (irr8) may be generated. this indicates that either a successful or an aborted mailbox transmission has just been made. if a message transmission is successful it is signalled in the txack register, and if a message transmission abortion is successful it is signalled in the aback register. by checking these registers, th e contents of the message of the corresponding mailbox may be modified to prepare for the next transmission. ? txpr1 bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * txpr1[15:0] note : * any write operation is ignored. read value is always h'0000. long word acce ss is mandatory when reading or writing txpr1/txpr0. writing any value to txpr1 is allowed, however, write operation to txpr1 has no effect. ? txpr0 bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * - txpr0[15:1] 0 note : * it is possible only to write a ?1? fo r a mailbox configured as transmitter.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 710 of 1080 rej09b0230-0300 bit 15 to 1 ? indicates that the corresponding mailbox is requested to transmit a can frame. the bit 15 to 1 corresponds to mailbox-15 to 1 re spectively. when multiple bits are set, the order of the transmissions is governed by the mcr2 ? can-id or mailbox number. bit[15:1]:txpr0 description 0 transmit message idle state in corresponding mailbox (initial value) [clearing condition] completion of message transmission or message transmission abortion (automatically cleared) 1 transmission request made for corresponding mailbox bit 0? reserved : this bit is always ?0? as this is a receive-only mailbox. writing a '1' to this bit position has no effect. the returned value is '0'. (2) transmit cancel register (txcr0) txcr0 is a 16-bit read / conditionally-write registers. the txcr0 controls mailbox-15 to mailbox-1.this register is used by the cpu to request the pending transmission requests in the txpr to be cancelled. to clear the corresponding bit in the txpr the cpu must write a '1' to the bit position in the txcr. writing a '0' has no effect. when an abort has succeeded th e can controller clears the corresponding txpr + txcr bits, and sets the corresponding aback bit. however, once a mailbox has started a transmission, it cannot be cancelled by this bit. in such a case, if the transmission finishes in success, the can controller clears the corresponding txpr + txcr bit, and sets the corresponding txack bit, however, if the transmission fails due to a bus arbitration loss or an error on the bus, the can controller clears the corresponding txpr + txcr bit, and sets the corresponding aback bit. if an attempt is made by the cpu to clear a mailbox transmission that is not transmit-pending it has no effect. in this case the cpu will be not able at all to set the txcr flag. ? txcr0 bit: initial value: r/w: 151413121110987654321 0 0 - 000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * 0 txcr0[15:1] note : * only writing a ?1? to a mailbox that is requested for transmission and is configured as transmit. bit 15 to 1 ? requests the corresponding mailbox, that is in the queue for transmission, to cancel its transmission. the bit 15 to 1 corresponds to mailbox-15 to 1 (and txpr0[15:1]) respectively.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 711 of 1080 rej09b0230-0300 bit[15:1]:txcr0 description 0 transmit message cancellation idle state in corresponding mailbox (initial value) [clearing condition] completion of transmit message cancellation (automatically cleared) 1 transmission cancellation request made for corresponding mailbox bit 0 ? this bit is always ?0? as this is a receive-only mailbox. writing a '1' to this bit position has no effect and always read back as a ?0?. (3) transmit acknowledge register (txack0) the txack0 is a 16-bit read / conditionally-write regi sters. this register is used to signal to the cpu that a mailbox transmission has been successf ully made. when a transmission has succeeded the rcan-et sets the corresponding bit in the txack register. the cpu may clear a txack bit by writing a '1' to the corresponding b it location. writing a '0' has no effect. ? txack0 bit: initial value: r/w: 151413121110987654321 0 0 - 000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * 0 txack0[15:1] note : * only when writing a ?1? to clear. bit 15 to 1 ? notifies that the requested transmission of the corresponding mailbox has been finished successfully. the bit 15 to 1 corresponds to mailbox-15 to 1 respectively. bit[15:1]:txack0 description 0 [clearing condition] writing ?1? (initial value) 1 corresponding mailbox has successfully transmitted message (data or remote frame) [setting condition] completion of message transmission for corresponding mailbox bit 0 ? this bit is always ?0? as this is a receive-only mailbox. writing a '1' to this bit position has no effect and always read back as a ?0?.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 712 of 1080 rej09b0230-0300 (4) abort acknowledge register (aback0) the aback0 is a 16-bit read / conditionally-write regi sters. this register is used to signal to the cpu that a mailbox transmission has been aborted as per its request. when an abort has succeeded the rcan-et sets the corresponding bit in the aback register. the cpu may clear the abort acknowledge bit by writing a '1' to the corresponding bit location. writing a '0' has no effect. an aback bit position is set by the rcan-et to acknowledge that a txpr bit has been cleared by the corresponding txcr bit. ? aback0 bit: initial value: r/w: 151413121110987654321 0 0 - 000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * 0 aback0[15:1] note : * only when writing a ?1? to clear. bit 15 to 1 ? notifies that the requested transmission cancellation of the corresponding mailbox has been performed successfully. the bit 15 to 1 corresponds to mailbox-15 to 1 respectively. bit[15:1]:aback0 description 0 [clearing condition] writing ?1? (initial value) 1 corresponding mailbox has cancelled transmission of message (data or remote frame) [setting condition] completion of transmission cancellation for corresponding mailbox bit 0 ? this bit is always ?0? as this is a receive-only mailbox. writing a '1' to this bit position has no effect and always read back as a ?0?. (5) data frame receive pending register (rxpr0) the rxpr0 is a 16-bit read / conditionally-write regi sters. the rxpr is a register that contains the received data frames pending flags associated with the conf igured receive mailboxes. when a can data frame is successfully stored in a receive mailbox the corresponding bit is set in the rxpr. the bit may be cleared by writing a '1' to the corresponding bit position. writing a '0' has no effect. however, the bit may only be set if the mailbox is configured by its mbc (mailbox configuration) to receive data frames. when a rx pr bit is set, it also sets irr1 (data frame received interrupt flag) if its mbimr (mailbox in terrupt mask register) is not set, and the interrupt signal is generated if imr1 is not set. please note that these bits are only set by receiving data frames and not by receiving remote frames.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 713 of 1080 rej09b0230-0300 ? rxpr0 bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * rxpr0[15:0] note : * only when writing a ?1? to clear. bit 15 to 0 ? configurable receive mailbox locations corresponding to each mailbox position from 15 to 0 respectively. bit[15:0]: rxpr0 description 0 [clearing condition] writing ?1? (initial value) 1 corresponding mailbox received a can data frame [setting condition] completion of data frame receive on corresponding mailbox (6) remote frame receive pending register (rfpr0) the rfpr0 is a 16-bit read / conditionally-write regist ers. the rfpr is a register that contains the received remote frame pending flag s associated with the configur ed receive mailboxes. when a can remote frame is successfully stored in a r eceive mailbox the corresponding bit is set in the rfpr. the bit may be cleared by writing a '1' to the corresponding bit position. writing a '0' has no effect. in effect there is a bit position for all mailboxes. however, the bit may only be set if the mailbox is configured by its mbc (mailbox confi guration) to receive remote frames. when a rfpr bit is set, it also sets irr2 (remote frame request interrupt flag) if its mbimr (mailbox interrupt mask register) is not set, and the interrupt signal is generated if imr2 is not set. please note that these bits are only set by receiving re mote frames and not by receiving data frames. ? rfpr0 bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * rfpr0[15:0] note : * only when writing a ?1? to clear. bit 15 to 0 ? remote request pending flags for mailboxes 15 to 0 respectively.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 714 of 1080 rej09b0230-0300 bit[15:0]: rfpr0 description 0 [clearing condition] writing ?1? (initial value) 1 corresponding mailbox received remote frame [setting condition] completion of remote frame receive in corresponding mailbox (7) mailbox interrupt mask register (mbimr) the mbimr1 and mbimr0 are 16-bit read / wr ite registers. the mbimr only prevents the setting of irr related to the mailbox activities, th at are irr[1] ? data frame received interrupt, irr[2] ? remote frame request interrupt, irr[8] ? mailbox empty interrupt, and irr[9] ? message overrun/overwrite interrupt. if a mail box is configured as receive, a mask at the corresponding bit position prevents the generation of a receive interrupt (irr[1] and irr[2] and irr[9]) but does not prevent the setting of the corresponding bit in the rxpr or rfpr or umsr. similarly when a mailbox has been configured for transmission, a mask prevents the generation of an interrupt signal and setting of an mailbox empty interrupt due to successful transmission or abortion of transmission (irr[8]), however, it does not prevent the rcan-et from clearing the corresponding txpr/txcr bit + setting the txack bit for successful transmission, and it does not prevent the rcan-et from clearing the corresponding txpr/txcr bit + setting the aback bit for abortion of the transmission. a mask is set by writing a '1' to the corresponding bit position for the mailbox activity to be masked. at reset all mailbox interrupts are masked. ? mbimr0 bit: initial value: r/w: 151413121110987654321 0 1111111111111111 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w mbimr0[15:0] bit 15 to 0 ? enable or disable interrupt requests from individual mailbox-15 to mailbox-0 respectively. bit[15:0]: mbimr0 description 0 interrupt request from irr1/irr2/irr8/irr9 enabled 1 interrupt request from irr1/irr2/irr8/irr9 disabled (initial value)
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 715 of 1080 rej09b0230-0300 (8) unread message status register (umsr) this register is a 16-bit read/conditionally write register and it records the mailboxes whose contents have not been accessed by the cpu prior to a new message being received. if the cpu has not cleared the corresponding bit in the rxpr or rfpr when a new message for that mailbox is received, the corresponding umsr bit is set to ?1?. this bit may be cleared by writing a ?1? to the corresponding bit location in the umsr. writing a ?0? has no effect. if a mailbox is configured as transmit box, the corresponding umsr will not be set. ? umsr0 bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * umsr0[15:0] note : * only when writing a ?1? to clear. bit 15 to 0 ? indicate that an unread received message has been overwritten or overrun condition has occurred for mailboxes 15 to 0. bit[15:0]: umsr0 description 0 [clearing condition] writing ?1? (initial value) 1 unread received message is overwritten by a new message or overrun condition [setting condition] when a new message is received before rxpr or rfpr is cleared
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 716 of 1080 rej09b0230-0300 17.4 application note 17.4.1 test mode settings the rcan-et has various test modes. the register tst[2:0] (mcr[10:8]) is used to select the rcan-et test mode. the default (initialised) settings allow rcan-et to operate in normal mode. the following table is examples for test modes. test mode can be selected only while in co nfiguration mode. the user must then exit the configuration mode (ensuring bcr0/bcr1 is set) in order to run the selected test mode. bit10: tst2 bit9: tst1 bit8: tst0 description 0 0 0 normal mode (initial value) 0 0 1 listen-only mode (receive-only mode) 0 1 0 self test mode 1 (external) 0 1 1 self test mode 2 (internal) 1 0 0 write error counter 1 0 1 error passive mode 1 1 0 setting prohibited 1 1 1 setting prohibited normal mode: rcan-et operates in the normal mode. listen-only mode: iso-11898 requires this mode for baud rate detection. the error counters are cleared and disabled so that the tec/rec does not increase the values, and the tx output is disabled so that rcan-et does not generate error frames or acknowledgment bits. irr13 is set when a message error occurs. self test mode 1: rcan-et generates its own acknowledge bit, and can store its own messages into a reception mailbox (if required). the rx/tx pins must be connected to the can bus. self test mode 2: rcan-et generates its own acknowledge bit, and can store its own messages into a reception mailbox (if required). the rx/tx pins do not need to be connected to the can bus or any external devices, as the internal tx is looped back to the internal rx. tx pin outputs only recessive bits and rx pin is disabled.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 717 of 1080 rej09b0230-0300 write error counter: tec/rec can be written in this mode. rcan-et can be forced to become an error passive mode by writing a value greater than 127 into the error counters. the va lue written into tec is us ed to write into rec, so only the same value can be set to these registers. similarly, rcan-et can be forced to become an error warning by writing a value greater than 95 into them. rcan-et needs to be in halt mode when writing into tec/rec (mcr1 must be "1" when writing to the error counter). furthermore this test mode needs to be exited prior to leaving halt mode.error passive mode: rcan-et can be forced to enter error passive mode. note: the rec will not be modified by implementing this mode. however, once running in error passive mode, the rec will increase normally should errors be received. in this mode, rcan-et will enter busoff if tec reaches 256 (dec). however when this mode is used rcan-et will not be able to become error active. consequently, at the end of the bus off recovery sequence, rcan-et will move to error passive and not to error active when message error occurs, irr13 is set in all test modes. 17.4.2 configuration of rcan-et rcan-et is considered in configuration mode or after a h/w (power on reset)/ s/w (mcr[0]) reset or when in halt mode. in both conditions rcan-et cannot join the can bus activity and configuration changes have no impact on the traffic on the can bus. ? after a reset request the following sequence must be implemented to configure the rcan-et after (s/w or h/w) reset. after reset, all the registers are initialised, therefore, rcan-et needs to be configured before joining the can bus activity . please read the notes carefully.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 718 of 1080 rej09b0230-0300 power on/sw reset * 1 clear irr[0] bit gsr[3] = 0? detect 11 recessive bits and join the can bus activity rcan-et is in tx_rx mode set txpr to start transmission or stay idle to receive confi g ure mcr[15] clear mcr[0] clear required imr bits set bit timin g (bcr) mailbox settin g (std-id, ext-id, lafm, dlc, rtr, ide, mbc, mbimr, dart, atx, nmc, messa g e-data) * 2 irr[0] = 1, gsr[3] = 1 (automatically) no yes transmission_reception (tx_rx) mode receive * 3 transmit * 3 notes: 1. sw reset could be performed at any time by settin g mcr[0] = 1. 2. mailboxes are comprised of rams, therefore, please initialise all the mailboxes enabled by mbc. 3. if there is no txpr set, rcan-et will receive the next incomin g messa g e. if there is a txpr(s) set, rcan-et will start transmission of the messa g e and will be arbitrated by the can bus. if it loses the arbitration, it will become a receiver. mcr[0] = 1 (automatically in hardware reset only) confi g uration mode reset sequence figure 17.8 reset sequence
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 719 of 1080 rej09b0230-0300 ? halt mode when rcan-et is in halt mode, it cannot take part to the can bus activity. consequently the user can modify all the requested registers without influencing existing traffic on the can bus. it is important for this that the user waits for the rcan-et to be in halt mode before to modify the requested registers - note that the transition to halt mode is not always immediate (transition will occurs when the can bus is idle or in intermission). after rcan-et transit to halt mode, gsr4 is set. once the configuration is completed the halt request needs to be released. rcan-et will join can bus activity after the detection of 11 recessive bits on the can bus. ? sleep mode when rcan-et is in sleep mode the clock for the main blocks of the ip is stopped in order to reduce power consumption. only the following us er registers are clocked and can be accessed: mcr, gsr, irr and imr. interrupt related to transmission (txack and aback) and reception (rxpr and rfpr) cannot be cleared when in sleep mode (as txack, aback, rxpr and rfpr are not accessible) a nd must to be cleared beforehand. the following diagram shows the flow to follow to move rcan-et into sleep mode.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 720 of 1080 rej09b0230-0300 sleep mode transmission/reception mode gsr[4] = 1? user monitor user monitor yes irr[0] = 1 write mcr[1] = 1 write irr[0] = 1 : hardware operation : manual operation irr[0] = 1 irr0 = 0 irr[12] = 1 write irr[0] = 1 irr[0] = 0 mcr[5] = 0 write irr[12] = 1 irr[12] = 0 write mcr[1] = 0 & mcr[5] = 1 halt request sleep request write irr[12] = 1 irr[12] = 0 write mcr[5] = 0 no can bus activity yes sleep mode sequence flow no gsr4 = 0? yes no mcr[7] = 1? yes no clk is stop only mcr, gsr, irr, imr can be accessed.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 721 of 1080 rej09b0230-0300 figure 17.9 - halt mode / sleep mode shows allowed state transition. ? please don't set mcr5 (sleep mode) without entering halt mode. ? after mcr1 is set, please don't clear it before gsr4 is set and rcan-et enters halt mode. power on/sw reset reset clear mcr0 and gsr3 = 0 clear mcr1 and mcr5 transmission reception set mcr1 * 3 halt request except transmitter/receiver/busoff, if mcr6 = 0 busoff or except transmitter/receiver, if mcr6 = 1 halt mode clear mcr5 * 1 clear mcr5 set mcr1 * 4 sleep mode set mcr5 clear mcr1 * 2 figure 17.9 halt mode / sleep mode notes: 1. mcr5 can be cleared by automatically by detecting a dominant bit on the can bus if mcr7 is set or by writing "0" 2. mcr1 is cleared in sw. clearing mcr1 and setting mcr5 have to be carried out by the same instruction. 3. mcr1 must not be cleared in sw, before gsr4 is set. mcr1 can be set automatically in hw when rcan-et moves to bus off and mcr14 and mcr6 are both set. 4. when mcr5 is cleared and mcr1 is set at the same time, rcan-et moves to halt request. right after that, it moves to halt mode with no reception/transmission. the following table shows conditions to access registers.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 722 of 1080 rej09b0230-0300 rcan-et registers status mode mcr gsr irr imr bcr mbimr flag_register mailbox (ctrl0, lafm) mailbox (data) mailbox (ctrl1) reset yes yes yes yes yes yes yes yes transmission reception halt request yes yes no * 1 yes yes no * 1 yes * 2 yes * 2 no * 1 yes * 2 halt yes yes no * 1 yes yes yes yes yes sleep yes yes no no no no no no notes: 1. no hardware protection 2. when txpr is not set.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 723 of 1080 rej09b0230-0300 17.4.3 message transmission sequence ? message transmission request the following sequence is an example to transmit a can frame onto the bus. as described in the previous register section, please note that irr8 is set when one of the txack or aback bits is set, meaning one of the mailboxes has completed its transmission or transmission abortion and is now ready to be updated for the next transmission, whereas, the gsr2 means that there is currently no transmission request made (no txpr flags set). no no no yes yes yes rcan-et is in tx_rx mode (mbc[x] = 0) write '1' to the txpr[x] bit at any desired time internal arbitration 'x' hi g hest priority? transmission start mailbox[x] is ready to be updated for next transmission clear txack[x] waitin g for interrupt waitin g for interrupt txack[x] = 1? can bus arbitration acknowled g e bit can bus irr8 = 1? update messa g e data of mailbox[x] figure 17.10 transmission request
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 724 of 1080 rej09b0230-0300 ? internal arbitration for transmission the following diagram explains how rcan-et manages to schedule transmission-requested messages in the correct order based on the can identifier. ?internal arbitration? picks up the highest priority message amongst transmit-requested messages. sof eof interm sof sof eof interm rcan-et scheduler state scheduler start point txpr/txcr/ error/arb-lost set point interm: intermission field sof: start of frame eof: end of frame messa g e: arbitration + control + data + crc + ack field transmission frame-1 reception frame-2 transmission frame-3 messa g e bus idle can bus state messa g e tx arb for frame-1 tx/rx arb for frame-1 tx/rx arb for frame-3/2 tx arb for frame-3 tx arb for frame-3 tx/rx arb for frame-3 1-1 1-2 2-1 2-2 3-1 3-2 figure 17.11 internal arbitration for transmission the rcan-et has two state machines. one is for tr ansmission, and the other is for reception. 1-1: when a txpr bit(s) is set while the can bus is idle, the internal arbitration starts running immediately and the transmission is started. 1-2: operations for both transmission and receptio n starts at sof. since there is no reception frame, rcan-et becomes transmitter. 2-1: at crc delimiter, internal arbitration to search next message transmitted starts. 2-2: operations for both transmission and receptio n starts at sof. because of a reception frame with higher priority, rcan-et b ecomes receiver. therefore, r eception is carried out instead of transmitting frame-3. 3-1: at crc delimiter, internal arbitration to search next message transmitted starts. 3-2: operations for both transmission and reception starts at sof. since a transmission frame has higher priority than reception one, rcan-et becomes transmitter. internal arbitration for the next transmission is also performed at the beginning of each error delimiter in case of an error is detected on the can bus. it is also performed at the beginning of error delimiters following overload frame.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 725 of 1080 rej09b0230-0300 as the arbitration for transmission is performed at crc delimiter, in case a remote frame request is received into a mailbox with atx=1 the answer can join the ar bitration for transmission only at the following bus idle, crc delimiter or error delimiter. depending on the status of the can bus, following the assertion of the txcr, the corresponding message abortion can be handled with a delay of maximum 1 can frame.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 726 of 1080 rej09b0230-0300 17.4.4 message receive sequence the diagram below shows the message receive sequence. rcan-et end of arbitration field notes: 1. only if cpu clears rxpr[n]/rfpr[n] at the same time that umsr is set in overrun, rxpr[n]/rfpr[n] may be set again eve n though the message has not been updated. 2. in case overwrite configuration (nmc = 1) is used for the mailbox n the message must be discarded when umsr[n] = 1, umsr[n] cleared and the full interrupt service routine started again. in case of overrun configuration (nmc = 0) is used clear again rxpr[n]/ rfpr[n]/ umsr[n] when umsr[n] = 1 and consider the message obsolate. can bus end of frame idle valid can-id received compare id with mailbox[n] + lafm[n] (if mbc is config to receive) store mailbox-number[n] and go back to idle state ? store message by overwriting ? set umsr ? set irr9 (if mbimr[n] = 0) ? generate interrupt signal (if imr9 = 0) ? set rxpr[n] (rfpr[n]) ? set irr1 (irr2) (if mbimr[n] = 0) ? generate interrupt signal (if imr1 (imr2) = 0) ? reject message ? set umsr ? set irr9 (if mbimr[n] = 0) ? generate interrupt signal (if imr9 = 0) ? set rxpr[n] (rfpr[n]) * 1 ? store message ? set rxpr[n] (rfpr[n]) ? set irr1 (irr2) (if mbimr[n] = 0) ? generate interrupt signal (if imr1 (imr2) = 0) valid can frame received check and clear umsr[n] * 2 write 1 to rxpr[n] read mailbox[n] irr[1] set ? read irr msg overwrite or overrun ? (nmc) overwrite overrun n = 0 ? n = n - 1 no no no no yes yes yes write 1 to rfpr[n] read mailbox[n] read rfpr[n] = 1 yes yes cpu received interrupt due to can message reception rxpr[n] (rfpr[n]) already set ? id matched ? interrupt signal interrupt signal interrupt signal loop (n = 15; n 0; n = n - 1) read rxpr[n] = 1 check and clear umsr[n] * 2 exit interrupt service routine figure 17.12 message receive sequence
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 727 of 1080 rej09b0230-0300 when rcan-et recognises the end of the arbitra tion field while receiving a message, it starts comparing the received identifier to the identifiers se t in the mailboxes, starting from mailbox-15 down to mailbox-0. it first checks the mbc if it is configured as a receive box, and reads lafm, and reads the can-id of mailbox-15 (if configured as receive) to finally compare them to the received id. if it does not match, the same chec k takes place at mailbox-14 (if configured as receive). once rcan-et finds a matching identifier, it stores the number of mailbox-[n] into an internal buffer, stops the search, and goes back to idle state, waiting for the endofframe (eof) to come. when the 6 th bit of eof is notified by the can interface logic, the received message is written or abandoned, depending on the nmc bit. no modification of configuration during communication is allowed. entering halt mode is one of ways to modify configuration. if it is written into the corresponding mailbox, including th e can-id, i.e., there is a possibility that the can-id is overwritten by a different can-id of the received message due to the lafm used. this also implies that, if the identifier of a received message matches to id + lafm of 2 or more mailboxes, the higher numbered mailbox will alwa ys store the relevant messages and the lower numbered mailbox will never receive messages. therefore, the settings of the identifiers and lafms need to be carefully selected. with regards to the reception of data and remote frames described in the above flow diagram the clearing of the umsr flag after the reading of i rr is to detect situations where a message is overwritten by a new incoming message stored in the same mailbox while the interrupt service routine is running. if during the final check of umsr a overwrite condition is detected the message needs to be discarded and read again. in case umsr is set and the mailbox is configur ed for overrun (nmc = 0) the message is still valid, however it is obsolete as it is not reflecting the latest message monitored on the can bus. please access the full mailbox content before clearing the related rxpr/rfpr flag. please note that in the case a received remote frame is overwritten by a data frame, both the remote frame request interrupt (irr2) and data frame received interrupt (irr1) and also the receive flags (rxpr and rfpr) are set. in an an alogous way, the overwriting of a data frame by a remote frame, leads to setting both irr2 and irr1. in the overrun mode (nmc = ?0?), only the first mailbox will cause the flags to be asserted. so, if a data frame is initially received, then rxpr a nd irr1 are both asserted. if a remote frame is then received before the data fram e has been read, then rfpr and irr2 are not set. in this case umsr of the corresponding mailbox will still be set.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 728 of 1080 rej09b0230-0300 17.4.5 reconfiguration of mailbox when re-configuration of mailboxes is required, the following procedures should be taken. ? change configuration of transmit box two cases are possible. ? change of id, rtr, ide, lafm, data, dlc, nmc, atx, dart this change is possible only when mbc=3'b000. confirm that the corresponding txpr is not set. the configuration (except m bc bit) can be changed at any time. ? change from transmit to receive configuration (mbc) confirm that the corresponding txpr is not set. the configuration can be changed only in halt or reset state. please note that it might take longer for rcan-et to transit to halt state if it is receiving or transmitting a message (as th e transition to the halt state is delayed until the end of the reception/transmission), and also rcan-et will not be able to receive/transmit messages during the halt state. in case rcan-et is in the bus off state th e transition to halt state depends on the configuration of the bit 6 of mcr and also bit and 14 of mcr. ? change configuration (id, rtr, ide, lafm, data, dlc, nmc, atx, dart, mbc) of receiver box or change receiver box to transmitter box the configuration can be changed only in halt mode. rcan-et will not lose a message if the message is currently on the can bus and rcan-et is a receiver. rcan-et will be moving into ha lt mode after completing the current reception. please note that it might take longer if rcan-et is receiving or transmitting a message (as the transition to the halt state is delayed until the end of the reception/transmission), and also rcan-et will not be able to receive /transmit messages during the halt mode. in case rcan-et is in the bus off state the transition to halt mode depends on the configuration of the bit 6 and 14 of mcr.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 729 of 1080 rej09b0230-0300 method by halt mode rcan-et is in tx_rx mode set mcr[1] (halt mode) is rcan-et transmitter, receiver or bus off? generate interrupt (irr0) read irr0 & gsr4 as '1' rcan-et is in halt mode chan g e id or mbc of mailbox clear mcr1 rcan-et is in tx_rx mode yes no the shadowed boxes need to be done by s/w (host processor) finish current session figure 17.13 change id of receive box or change r eceive box to transmit box
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 730 of 1080 rej09b0230-0300 17.5 interrupt sources table 17.2 lists the rcan-et interrupt sources. with the exception of the reset processing interrupt (irr0) by a power-on reset, these sources can be masked. masking is implemented using the mailbox interrupt mask register 0 (mbimr0) and interrupt mask register (imr). for details on the interrupt vector of each interrupt source, see section 6, interrupt controller (intc). table 17.2 rcan-et interrupt sources module interrupt description interrupt flag dtc activation error passive mode (tec 128 or rec 128) irr5 bus off (tec 256)/bus off recovery irr6 error warning (tec 96) irr3 ers_0 error warning (rec 96) irr4 message error detection irr13 * 1 reset/halt/can sleep transition irr0 overload frame transmission irr7 unread message overwrite (overrun) irr9 ovr_0 detection of can bus operation in can sleep mode irr12 not possible data frame reception irr1 * 3 rcan-et_0 rm0_0 * 2 rm1_0 * 2 remote frame reception irr2 * 3 possible * 4 sle_0 message transmission/transmission disabled (slot empty) irr8 not possible notes: 1. available only in test mode. 2. rm0_0 is an interrupt generated by the remote request pending flag for mailbox 0 (rfpr0[0]) or the data frame receive flag for mailbox 0 (rxpr0[0]). rm1_0 is an interrupt generated by the remote request pending flag for mailbox n (rfpr0[n]) or the data frame receive flag for mailbox n (rxpr0[n]) (n = 1 to 15). 3. irr1 is a data frame received interrupt flag for mailboxes 0 to 15, and irr2 is a remote frame request interrupt flag for mailboxes 0 to 15. 4. the dtc can be activated only by the rm0_0 interrupt.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 731 of 1080 rej09b0230-0300 17.6 dtc interface the dtc can be activated by the reception of a message in rcan-et mailbox 0. when dtc transfer ends after dtc activation has been set, flags of rxpr0 and rfpr0 are cleared automatically. an interrupt request due to a receive interrupt from the rcan-et cannot be sent to the cpu in this case. figure 17.14 shows a dtc transfer flowchart. dtc initialization dtc enable re g ister settin g dtc re g ister information settin g end of dtc transfer? rxpr and rfpr fla g s clearin g yes end messa g e reception in rcan-et mailbox 0 interrupt to cpu transfer counter = 0 or disel = 1? yes dtc activation : settin g s by user : processin g by hardware no no figure 17.14 dtc transfer flowchart
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 732 of 1080 rej09b0230-0300 17.7 can bus interface a bus transceiver ic is necessary to connect this lsi to a can bus. a renesas ha13721 transceiver ic and its compatible products are recommended. figure 17.15 shows a sample connection diagram. mode rxd txd nc canh vcc canl gnd crx0 [le g end] nc: no connection ctx0 this lsi can bus 120 120 vcc ha13721 figure 17.15 high-speed can interface using ha13721
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 733 of 1080 rej09b0230-0300 17.8 usage notes 17.8.1 module stop mode the clock supply to rcan-et can be stopped or started by using the standby control register 3 (stbcr3). with the initial value, the clock supply is stopped. access to the rcan-et registers should be made only after releasing rcan-et from module stop mode. 17.8.2 reset rcan-et can be reset by hardware reset or software reset. ? hardware reset rcan-et is reset to the initial state by power-on reset or on entering hardware standby, module stop, or software standby mode. ? software reset by setting the mcr0 bit in master control register (mcr), rcan-et registers, excluding the mcr0 bit, and the can communication circuitry are initialized. since the irr0 bit in interrupt request register (irr) is set by the initialization upon reset, it should be cleared while rcan-et is in configuration mode during the reset sequence. the areas except for message control field 1 (control1) of mailboxes are not initialized by reset because they are in ram. after power-on reset, all mailboxes should be initialized while rcan-et is in configuration mode during the reset sequence. 17.8.3 can sleep mode in can sleep mode, the clock supply to the major parts in the module is stopped. therefore, do not make access in can sleep mode except for acce ss to the mcr, gsr, irr, and imr registers. 17.8.4 register access if the mailbox area is accessed while the can co mmunication circuitry in rcan-et is storing a received can bus frame in a mailbox, a 0 to five peripheral clock cycles of wait state is generated.
section 17 controller area network (rcan-et) rev. 3.00 oct. 06, 2008 page 734 of 1080 rej09b0230-0300 17.8.5 interrupts as shown in table 17.2, a mailbox 0 receive inte rrupt can activate the dtc. if configured such that the dtc is activated by a mailbox 0 receive in terrupt and clearing of th e interrupt source flag upon dtc transfer is enabled, use block transfer mode and read the whole mailbox 0 message up to the message control field 1 (control1).
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 735 of 1080 rej09b0230-0300 section 18 pin function controller (pfc) the pin function controller (pfc) is composed of registers that are used to select the functions of multiplexed pins and assign pins to be inputs or outputs. tables 18.1 to 18.4 list the multiplexed pins of this lsi. table 18.5 lists the pin functions in each operating mode. table 18.1 multiplexed pins (port a) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) function 5 (related module) a pa0 i/o (port) a0 output (bsc) poe0 input (poe) rxd0 input (sci) ? pa1 i/o (port) a1 output (bsc) poe1 input (poe) txd0 output (sci) ? pa2 i/o (port) a2 output (bsc) irq0 input (intc) poe2 input (poe) sck0 i/o (sci) pa3 i/o (port) a3 output (bsc) irq1 input (intc) rxd1 input (sci) ? pa4 i/o (port) a4 output (bsc) irq2 input (intc) txd1 output (sci) ? pa5 i/o (port) a5 output (bsc) irq3 input (intc) sck1 i/o (sci) ? pa6 i/o (port) rd output (bsc) ubctrg output (ubc) tclka input (mtu2) poe4 input (poe) pa7 i/o (port) tclkb input (mtu2) poe5 input (poe) sck2 i/o (sci) ? pa8 i/o (port) wrl output (bsc) tclkc input (mtu2) poe6 input (poe) rxd2 input (sci) pa9 i/o (port) wait input (bsc) tclkd input (mtu2) poe8 input (poe) txd2 output (sci) pa10 i/o (port) a6 output (bsc) rxd0 input (sci) ? ? pa11 i/o (port) a7 output (bsc) txd0 output (sci) adtrg input (a/d) ? pa12 i/o (port) a8 output (bsc) sck0 i/o (sci) scs i/o ( * ) ? pa13 i/o (port) a9 output (bsc) sck1 i/o (sci) ssck i/o ( * ) ? pa14 i/o (port) a10 output (bsc) rxd1 input (sci) ssi i/o ( * ) ? pa15 i/o (port) ck output (cpg) txd1 output (sci) sso i/o ( * ) ? note: * synchronous serial communication unit
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 736 of 1080 rej09b0230-0300 table 18.2 multiplexed pins (port b) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) function 5 (related module) b pb0 i/o (port) back output (bsc) tic5ws input (mtu2s) ctx1 output (rcan-et) * ? pb1 i/o (port) breq input (bsc) crx1 input (rcan-et) * ? ? pb2 i/o (port) a16 output (bsc) irq0 input (intc) poe0 input (poe) tic5vs input (mtu2s) pb3 i/o (port) a17 output (bsc) irq1 input (intc) poe1 input (poe) ? pb4 i/o (port) a18 output (bsc) irq2 input (intc) poe4 input (poe) tic5us input (mtu2s) pb5 i/o (port) a19 output (bsc) irq3 input (intc) poe5 input (poe) ? pb6 i/o (port) wait input (bsc) ctx0 output (rcan-et) ? ? pb7 i/o (port) cs1 output (bsc) crx0 input (rcan-et) ? ? note: * available only in the sh7142. table 18.3 multiplexed pins (port d) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) function 5 (related module) d pd0 i/o (port) d0 i/o (bsc) rxd0 input (sci) audata0 output (aud) ? pd1 i/o (port) d1 i/o (bsc) txd0 output (sci) audata1 output (aud) ? pd2 i/o (port) d2 i/o (bsc) sck0 i/o (sci) audata2 output (aud) ? pd3 i/o (port) d3 i/o (bsc) rxd1 input (sci) audata3 output (aud) ? pd4 i/o (port) d4 i/o (bsc) txd1 output (sci) audrst input (aud) ? pd5 i/o (port) d5 i/o (bsc) sck1 i/o (sci) audmd input (aud) ? pd6 i/o (port) d6 i/o (bsc) rxd2 input (sci) audck output (aud) ? pd7 i/o (port) d7 i/o (bsc) txd2 output (sci) scs i/o ( * ) audsync output (aud) pd8 i/o (port) sck2 i/o (sci) ssck i/o ( * ) ? ? pd9 i/o (port) ssi i/o ( * ) ? ? ? pd10 i/o (port) sso i/o ( * ) ? ? ? note: * synchronous serial communication unit
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 737 of 1080 rej09b0230-0300 table 18.4 multiplexed pins (port e) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) function 5 (related module) e pe0 i/o (port) tioc0a i/o (mtu2) ? ? ? pe1 i/o (port) tioc0b i/o (mtu2) rxd0 input (sci) ? ? pe2 i/o (port) tioc0c i/o (mtu2) txd0 output (sci) ? ? pe3 i/o (port) tioc0d i/o (mtu2) sck0 i/o (sci) ? ? pe4 i/o (port) a11 output (bsc) tioc1a i/o (mtu2) rxd1 input (sci) ? pe5 i/o (port) a12 output (bsc) tioc1b i/o (mtu2) txd1 output (sci) ? pe6 i/o (port) a13 output (bsc) tioc2a i/o (mtu2) sck1 i/o (sci) ? pe7 i/o (port) a14 output (bsc) tioc2b i/o (mtu2) ? ? pe8 i/o (port) a15 output (bsc) tioc3a i/o (mtu2) ? ? pe9 i/o (port) tioc3b i/o (mtu2) ? ? ? pe10 i/o (port) cs0 output (bsc) tioc3c i/o (mtu2) ? ? pe11 i/o (port) tioc3d i/o (mtu2) ? ? ? pe12 i/o (port) tioc4a i/o (mtu2) ? ? ? pe13 i/o (port) tioc4b i/o (mtu2) mres input (intc) ? ? pe14 i/o (port) tioc4c i/o (mtu2) ? ? ? pe15 i/o (port) tioc4d i/o (mtu2) irqout output (intc) ? ? pe16 i/o (port) wait input (bsc) tioc3bs i/o (mtu2s) ? ? pe17 i/o (port) cs0 output (bsc) tioc3ds i/o (mtu2s) ? ? pe18 i/o (port) cs1 output (bsc) tioc4as i/o (mtu2s) ? ? pe19 i/o (port) rd output (bsc) tioc4bs i/o (mtu2s) ? ? pe20 i/o (port) tioc4cs i/o (mtu2s) ? ? ? pe21 i/o (port) wrl output (bsc) tioc4ds i/o (mtu2s) ? ?
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 738 of 1080 rej09b0230-0300 table 18.5 pin functions in each operating mode (1) pin name on-chip rom disabled (mcu mode 0) pin no. initial function pfc selected function possibilities 48, 3 vcc vcc 50, 1 vss vss 11, 36, 57, 76 pvcc pvcc 14, 39, 64 pvss pvss 16, 59 v cl v cl 98 avcc avcc 79 avss avss 88 avrefh avrefh 93 avrefl avrefl 75 pllvss pllvss 72 extal extal 71 xtal xtal 78 md0 md0 77 md1 md1 74 fwe fwe 70 res res 100 wdtovf wdtovf 73 nmi nmi 99 hstby hstby 69 a0 pa0/a0/ poe0 /rxd0 68 a1 pa1/a1/ poe1 /txd0 67 a2 pa2/a2/irq0/ poe2 /sck0 66 a3 pa3/a3/irq1/rxd1 65 a4 pa4/a4/irq2/txd1 63 a5 pa5/a5/irq3/sck1 62 rd pa6/ rd / ubctrg /tclka/ poe4 61 pa7 pa7/tclkb/ poe5 /sck2
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 739 of 1080 rej09b0230-0300 pin name on-chip rom disabled (mcu mode 0) pin no. initial function pfc selected function possibilities 60 wrl pa8/ wrl /tclkc/ poe6 /rxd2 58 pa9 pa9/ wait /tclkd/ poe8 /txd2 56 a6 pa10/a6/rxd0 55 a7 pa11/a7/txd0/ adtrg 54 a8 pa12/a8/sck0/ scs 53 a9 pa13/a9/sck1/ssck 52 a10 pa14/a10/rxd1/ssi 51 ck pa15/ck/txd1/sso 49 pb0 pb0/ back /tic5ws/ctx1 * 47 pb1 pb1/ breq /crx1 * 46 a16 pb2/a16/irq0/ poe0 /tic5vs 45 a17 pb3/a17/irq1/ poe1 44 pb4 pb4/a18/irq2/ poe4 /tic5us 43 pb5 pb5/a19/irq3/ poe5 42 pb6 pb6/ wait /ctx0 41 pb7 pb7/ cs1 /crx0 40 d0 pd0/d0/rxd0/audata0 38 d1 pd1/d1/txd0/audata1 37 d2 pd2/d2/sck0/audata2 35 d3 pd3/d3/rxd1/audata3 34 d4 pd4/d4/txd1/ audrst 33 d5 pd5/d5/sck1/audmd 32 d6 pd6/d6/rxd2/audck 31 d7 pd7/d7/txd2/ scs / audsync 30 pd8 pd8/sck2/ssck 29 pd9 pd9/ssi 28 pd10 pd10/sso 27 pe0 pe0/tioc0a 26 pe1 pe1/tioc0b/rxd0 25 pe2 pe2/tioc0c/txd0
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 740 of 1080 rej09b0230-0300 pin name on-chip rom disabled (mcu mode 0) pin no. initial function pfc selected function possibilities 24 pe3 pe3/tioc0d/sck0 23 a11 pe4/a11/tioc1a/rxd1 22 a12 pe5/a12/tioc1b/txd1 21 a13 pe6/a13/tioc2a/sck1 20 a14 pe7/a14/tioc2b 19 a15 pe8/a15/tioc3a 17 pe9 pe9/tioc3b 18 cs0 pe10/ cs0 /tioc3c 15 pe11 pe11/tioc3d 13 pe12 pe12/tioc4a 12 pe13 pe13/tioc4b/ mres 10 pe14 pe14/tioc4c 9 pe15 pe15/tioc4d/ irqout 8 pe16 pe16/ wait /tioc3bs 7 pe17 pe17/ cs0 /tioc3ds 6 pe18 pe18/ cs1 /tioc4as 5 pe19 pe19/ rd /tioc4bs 4 pe20 pe20/tioc4cs 2 pe21 pe21/ wrl /tioc4ds 97 an0 an0 96 an1 an1 95 an2 an2 94 an3 an3 92 an4 an4 91 an5 an5 90 an6 an6 89 an7 an7 87 an8 an8 86 an9 an9 85 an10 an10
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 741 of 1080 rej09b0230-0300 pin name on-chip rom disabled (mcu mode 0) pin no. initial function pfc selected function possibilities 84 an11 an11 83 an12 an12 82 an13 an13 81 an14 an14 80 an15 an15 note: * available only in the sh7142.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 742 of 1080 rej09b0230-0300 table 18.5 pin functions in each operating mode (2) pin name on-chip rom enabled (mcu mode 2) single-chip mode (mcu mode 3) pin no. initial function pfc selected function possibilities initial function pfc selected function possibilities 48, 3 vcc vcc vcc vcc 50, 1 vss vss vss vss 11, 36, 57, 76 pvcc pvcc pvcc pvcc 14, 39, 64 pvss pvss pvss pvss 16, 59 v cl v cl v cl v cl 98 avcc avcc avcc avcc 79 avss avss avss avss 88 avrefh avrefh avrefh avrefh 93 avrefl avrefl avrefl avrefl 75 pllvss pllvss pllvss pllvss 72 extal extal extal extal 71 xtal xtal xtal xtal 78 md0 md0 md0 md0 77 md1 md1 md1 md1 74 fwe fwe fwe fwe 70 res res res res 100 wdtovf wdtovf wdtovf wdtovf 73 nmi nmi nmi nmi 99 hstby hstby hstby hstby 69 pa0 pa0/a0/ poe0 /rxd0 pa0 pa0/a0/ poe0 /rxd0 68 pa1 pa1/a1/ poe1 /txd0 pa1 pa1/a1/ poe1 /txd0 67 pa2 pa2/a2/irq0/ poe2 /sck0 pa2 pa2/a2/irq0/ poe2 /sck0 66 pa3 pa3/a3/irq1/rxd1 pa3 pa3/a3/irq1/rxd1 65 pa4 pa4/a4/irq2/txd1 pa4 pa4/a4/irq2/txd1 63 pa5 pa5/a5/irq3/sck1 pa5 pa5/a5/irq3/sck1 62 pa6 pa6/ rd / ubctrg /tclka/ poe4 pa6 pa6/ rd / ubctrg /tclka / poe4
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 743 of 1080 rej09b0230-0300 pin name on-chip rom enabled (mcu mode 2) single-chip mode (mcu mode 3) pin no. initial function pfc selected function possibilities initial function pfc selected function possibilities 61 pa7 pa7/tclkb/ poe5 /sck2 pa7 pa7/tclkb/ poe5 /sck2 60 pa8 pa8/ wrl /tclkc/ poe6 /rxd2 pa8 pa8/ wrl /tclkc/ poe6 /rxd2 58 pa9 pa9/ wait /tclkd/ poe8 /txd2 pa9 pa9/ wait /tclkd/ poe8 /txd2 56 pa10 pa10/a6/rxd0 pa10 pa10/a6/rxd0 55 pa11 pa11/a7/txd0/ adtrg pa11 pa11/a7/txd0/ adtrg 54 pa12 pa12/a8/sck0/ scs pa12 pa12/a8/sck0/ scs 53 pa13 pa13/a9/sck1/ssck pa13 pa13/a9/sck1/ssck 52 pa14 pa14/a10/rxd1/ssi pa14 pa14/a10/rxd1/ssi 51 ck pa15/ck/txd1/sso pa15 pa15/ck/txd1/sso 49 pb0 pb0/ back /tic5ws/ctx1 * pb0 pb0/ back /tic5ws/ctx1 * 47 pb1 pb1/ breq /crx1 * pb1 pb1/ breq /crx1 * 46 pb2 pb2/a16/irq0/ poe0 /tic5vs pb2 pb2/a16/irq0/ poe0 /tic5vs 45 pb3 pb3/a17/irq1/ poe1 pb3 pb3/a17/irq1/ poe1 44 pb4 pb4/a18/irq2/ poe4 /tic5us pb4 pb4/a18/irq2/ poe4 /tic5us 43 pb5 pb5/a19/irq3/ poe5 pb5 pb5/a19/irq3/ poe5 42 pb6 pb6/ wait /ctx0 pb6 pb6/ wait /ctx0 41 pb7 pb7/ cs1 /crx0 pb7 pb7/ cs1 /crx0 40 pd0 pd0/d0/rxd0/audata0 pd0 pd0/d0/rxd0/audata0 38 pd1 pd1/d1/txd0/audata1 pd1 pd1/d1/txd0/audata1 37 pd2 pd2/d2/sck0/audata2 pd2 pd2/d2/sck0/audata2 35 pd3 pd3/d3/rxd1/audata3 pd3 pd3/d3/rxd1/audata3 34 pd4 pd4/d4/txd1/ audrst pd4 pd4/d4/txd1/ audrst 33 pd5 pd5/d5/sck1/audmd pd5 pd5/d5/sck1/audmd 32 pd6 pd6/d6/rxd2/audck pd6 pd6/d6/rxd2/audck 31 pd7 pd7/d7/txd2/ scs / audsync pd7 pd7/d7/txd2/ scs / audsync 30 pd8 pd8/sck2/ssck pd8 pd8/sck2/ssck 29 pd9 pd9/ssi pd9 pd9/ssi 28 pd10 pd10/sso pd10 pd10/sso 27 pe0 pe0/tioc0a pe0 pe0/tioc0a
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 744 of 1080 rej09b0230-0300 pin name on-chip rom enabled (mcu mode 2) single-chip mode (mcu mode 3) pin no. initial function pfc selected function possibilities initial function pfc selected function possibilities 26 pe1 pe1/tioc0b/rxd0 pe1 pe1/tioc0b/rxd0 25 pe2 pe2/tioc0c/txd0 pe2 pe2/tioc0c/txd0 24 pe3 pe3/tioc0d/sck0 pe3 pe3/tioc0d/sck0 23 pe4 pe4/a11/tioc1a/rxd1 pe4 pe4/a11/tioc1a/rxd1 22 pe5 pe5/a12/tioc1b/txd1 pe5 pe5/a12/tioc1b/txd1 21 pe6 pe6/a13/tioc2a/sck1 pe6 pe6/a13/tioc2a/sck1 20 pe7 pe7/a14/tioc2b pe7 pe7/a14/tioc2b 19 pe8 pe8/a15/tioc3a pe8 pe8/a15/tioc3a 17 pe9 pe9/tioc3b pe9 pe9/tioc3b 18 pe10 pe10/ cs0 /tioc3c pe10 pe10/ cs0 /tioc3c 15 pe11 pe11/tioc3d pe11 pe11/tioc3d 13 pe12 pe12/tioc4a pe12 pe12/tioc4a 12 pe13 pe13/tioc4b/ mres pe13 pe13/tioc4b/ mres 10 pe14 pe14/tioc4c pe14 pe14/tioc4c 9 pe15 pe15/tioc4d/ irqout pe15 pe15/tioc4d/ irqout 8 pe16 pe16/ wait /tioc3bs pe16 pe16/ wait /tioc3bs 7 pe17 pe17/ cs0 /tioc3ds pe17 pe17/ cs0 /tioc3ds 6 pe18 pe18/ cs1 /tioc4as pe18 pe18/ cs1 /tioc4as 5 pe19 pe19/ rd /tioc4bs pe19 pe19/ rd /tioc4bs 4 pe20 pe20/tioc4cs pe20 pe20/tioc4cs 2 pe21 pe21/ wrl /tioc4ds pe21 pe21/ wrl /tioc4ds 97 an0 an0 an0 an0 96 an1 an1 an1 an1 95 an2 an2 an2 an2 94 an3 an3 an3 an3 92 an4 an4 an4 an4 91 an5 an5 an5 an5 90 an6 an6 an6 an6 89 an7 an7 an7 an7
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 745 of 1080 rej09b0230-0300 pin name on-chip rom enabled (mcu mode 2) single-chip mode (mcu mode 3) pin no. initial function pfc selected function possibilities initial function pfc selected function possibilities 87 an8 an8 an8 an8 86 an9 an9 an9 an9 85 an10 an10 an10 an10 84 an11 an11 an11 an11 83 an12 an12 an12 an12 82 an13 an13 an13 an13 81 an14 an14 an14 an14 80 an15 an15 an15 an15 note: * available only in the sh7142.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 746 of 1080 rej09b0230-0300 18.1 register descriptions the pfc has the following registers. for details on register addresses and register states in each processing state, refer to section 24, list of registers. table 18.6 register configuration register name abbreviation r/w initial value address access size port a i/o register l paiorl r/w h'0000 h'ffffd106 8, 16 port a control register l4 pacrl4 r/w h'0000 * h'ffffd110 8, 16, 32 port a control register l3 pacrl3 r/w h'0000 * h'ffffd112 8, 16 port a control register l2 pacrl2 r/w h'0000 * h'ffffd114 8, 16, 32 port a control register l1 pacrl1 r/w h'0000 * h'ffffd116 8, 16 port b i/o register l pbiorl r/w h'0000 h'ffffd186 8, 16 port b control register l2 pbcrl2 r/w h'0000 h'ffffd194 8, 16, 32 port b control register l1 pbcrl1 r/w h'0000 * h'ffffd196 8, 16 port d i/o register l pdiorl r/w h'0000 h'ffffd286 8, 16 port d control register l3 pdcrl3 r/w h'0000 h'ffffd292 8, 16 port d control register l2 pdcrl2 r/w h'0000 * h'ffffd294 8, 16, 32 port d control register l1 pdcrl1 r/w h'0000 * h'ffffd296 8, 16 port e i/o register h peiorh r/w h'0000 h'ffffd304 8, 16, 32 port e i/o register l peiorl r/w h'0000 h'ffffd306 8, 16 port e control register h2 pecrh2 r/w h'0000 h'ffffd30c 8, 16, 32 port e control register h1 pecrh1 r/w h'0000 h'ffffd30e 8, 16 port e control register l4 pecrl4 r/w h'0000 h'ffffd310 8, 16, 32 port e control register l3 pecrl3 r/w h'0000 * h'ffffd312 8, 16 port e control register l2 pecrl2 r/w h'0000 * h'ffffd314 8, 16, 32 port e control register l1 pecrl1 r/w h'0000 h'ffffd316 8, 16 note: * the initial value differs between in the on-chip rom enabled external-extension mode and in the on-chip rom disabled external-extension mode. for details, refer to register descriptions in this section.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 747 of 1080 rej09b0230-0300 18.1.1 port a i/o register l (paiorl) paiorl is a 16-bit readable/writable register that is used to set the pins on port a as inputs or outputs. bits pa15ior to pa0ior correspond to pins pa15 to pa0 (names of multiplexed pins are here given as port names and pin numbers alone). paiorl is enabled when the port a pins are functioning as general-purpose inputs/outputs (pa15 to pa0). in other states, paiorl is disabled. a given pin on port a will be an output pin if the corresponding bit in paiorl is set to 1, and an input pin if the bit is cleared to 0. the initial value of paiorl is h'0000. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w pa15 ior pa14 ior pa13 ior pa12 ior pa11 ior pa10 ior pa 9 ior pa 8 ior pa 7 ior pa 6 ior pa 5 ior pa 4 ior pa 3 ior pa 2 ior pa 1 ior pa 0 ior
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 748 of 1080 rej09b0230-0300 18.1.2 port a control registers l1 to l4 (pacrl1 to pacrl4) pacrl1 to pacrl4 are 16-bit readable/writable regist ers that are used to select the functions of the multiplexed pins on port a. ? port a control register l4 (pacrl4) bit: initial value: r/w: 151413121110987654321 0 0000 * 1 00 * 2 0000 * 2 0000 * 2 00 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w notes: the initial value is 1 in the on-chip rom enabled/disabled external-extension mode. the initial value is 1 in the on-chip rom disabled external-extension mode. 1. 2. - pa15 md2 pa15 md1 pa15 md0 - pa14 md2 pa14 md1 pa 1 4 md0 - pa13 md2 pa 1 3 md1 pa13 md0 - pa12 md2 pa12 md1 pa12 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pa15md2 pa15md1 pa15md0 0 0 0 * 1 r/w r/w r/w pa15 mode select the function of the pa15/ck/txd1/sso pin. 000: pa15 i/o (port) 001: ck output (cpg) * 3 101: sso i/o (synchronous serial communication unit) 110: txd1 output (sci) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 pa14md2 pa14md1 pa14md0 0 * 2 0 0 r/w r/w r/w pa14 mode select the function of the pa14/a10/rxd1/ssi pin. 000: pa14 i/o (port) 100: a10 output (bsc) * 3 101: ssi i/o (synchronous serial communication unit) 110: rxd1 input (sci) other than above: setting prohibited
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 749 of 1080 rej09b0230-0300 bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 5 4 pa13md2 pa13md1 pa13md0 0 * 2 0 0 r/w r/w r/w pa13 mode select the function of the pa13/a9/sck1/ssck pin. 000: pa13 i/o (port) 100: a9 output (bsc) * 3 101: ssck i/o (synchronous serial communication unit) 110: sck1 i/o (sci) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pa12md2 pa12md1 pa12md0 0 * 2 0 0 r/w r/w r/w pa12 mode select the function of the pa12/a8/sck0/ scs pin. 000: pa12 i/o (port) 100: a8 output (bsc) * 3 101: scs i/o (synchronous serial communication unit) 110: sck0 i/o (sci) other than above: setting prohibited notes: 1. the initial value is 1 in the on-chip rom enabled/disabled external-extension mode. 2. the initial value is 1 in the on-chip rom disabled external-extension mode. 3. this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 750 of 1080 rej09b0230-0300 ? port a control register l3 (pacrl3) bit: initial value: r/w: 151413121110987654321 0 00 * 1 0000 * 1 00000000 * 1 00 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w note: the initial value is 1 in the on-chip rom disabled external-extension mode. 1. - pa11 md2 pa11 md1 pa11 md0 - pa10 md2 pa10 md1 pa 1 0 md0 - pa 9 md2 pa 9 md1 pa 9 md0 - pa 8 md2 pa 8 md1 pa 8 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pa11md2 pa11md1 pa11md0 0 * 1 0 0 r/w r/w r/w pa11 mode select the function of the pa11/a7/txd0/ adtrg pin. 000: pa11 i/o (port) 010: adtrg input (a/d) 100: a7 output (bsc) * 2 110: txd0 output (sci) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 pa10md2 pa10md1 pa10md0 0 * 1 0 0 r/w r/w r/w pa10 mode select the function of the pa10/a6/rxd0 pin. 000: pa10 i/o (port) 100: a6 output (bsc) * 2 110: rxd0 input (sci) other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 751 of 1080 rej09b0230-0300 bit bit name initial value r/w description 6 5 4 pa9md2 pa9md1 pa9md0 0 0 0 r/w r/w r/w pa9 mode select the function of the pa9/ wait /tclkd/ poe8 /txd2 pin. 000: pa9 i/o (port) 001: tclkd input (mtu2) 100: wait input (bsc) * 2 110: txd2 output (sci) 111: poe8 input (poe) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pa8md2 pa8md1 pa8md0 0 * 1 0 0 r/w r/w r/w pa8 mode select the function of the pa8/ wrl /tclkc/ poe6 /rxd2 pin. 000: pa8 i/o (port) 001: tclkc input (mtu2) 100: wrl output (bsc) * 2 110: rxd2 input (sci) 111: poe6 input (poe) other than above: setting prohibited notes: 1 . the initial value is 1 in the on-chip rom disabled external-extension mode. 2. this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 752 of 1080 rej09b0230-0300 ? port a control register l2 (pacrl2) bit: initial value: r/w: 151413121110987654321 0 0000000 * 1 0 * 1 00 * 1 0000 * 1 00 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w note: the initial value is 1 in the on-chip rom disabled external-extension mode. 1. - pa 7 md2 pa 7 md1 pa 7 md0 - pa 6 md2 pa 6 md1 pa 6 md0 - pa 5 md2 pa 5 md1 pa 5 md0 - pa 4 md2 pa 4 md1 pa 4 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pa7md2 pa7md1 pa7md0 0 0 0 r/w r/w r/w pa7 mode select the function of the pa7/tclkb/ poe5 /sck2 pin. 000: pa7 i/o (port) 001: tclkb input (mtu2) 110: sck2 i/o (sci) 111: poe5 input (poe) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 pa6md2 pa6md1 pa6md0 0 0 * 1 0 * 1 r/w r/w r/w pa6 mode select the function of the pa6/ rd / ubctrg /tclka/ poe4 pin. 000: pa6 i/o (port) 001: tclka input (mtu2) 011: rd output (bsc) * 2 101: ubctrg output (ubc) 111: poe4 input (poe) other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 753 of 1080 rej09b0230-0300 bit bit name initial value r/w description 6 5 4 pa5md2 pa5md1 pa5md0 0 * 1 0 0 r/w r/w r/w pa5 mode select the function of the pa5/a5/irq3/sck1 pin. 000: pa5 i/o (port) 001: sck1 i/o (sci) 100: a5 output (bsc) * 2 111: irq3 input (intc) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pa4md2 pa4md1 pa4md0 0 * 1 0 0 r/w r/w r/w pa4 mode select the function of the pa4/a4/irq2/txd1 pin. 000: pa4 i/o (port) 001: txd1 output (sci) 100: a4 output (bsc) * 2 111: irq2 input (intc) other than above: setting prohibited notes: 1 . the initial value is 1 in the on-chip rom disabled external-extension mode. 2. this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 754 of 1080 rej09b0230-0300 ? port a control register l1 (pacrl1) bit: initial value: r/w: 151413121110987654321 0 00 * 1 0000 * 1 0000 * 1 0000 * 00 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w note: the initial value is 1 in the on-chip rom disabled external-extension mode. 1. - pa 3 md2 pa 3 md1 pa 3 md0 - pa 2 md2 pa 2 md1 pa 2 md0 - pa 1 md2 pa 1 md1 pa 1 md0 - pa 0 md2 pa 0 md1 pa 0 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pa3md2 pa3md1 pa3md0 0 * 1 0 0 r/w r/w r/w pa3 mode select the function of the pa3/a3/irq1/rxd1 pin. 000: pa3 i/o (port) 001: rxd1 input (sci) 100: a3 output (bsc) * 2 111: irq1 input (intc) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 pa2md2 pa2md1 pa2md0 0 * 1 0 0 r/w r/w r/w pa2 mode select the function of the pa2/a2/irq0/ poe2 /sck0 pin. 000: pa2 i/o (port) 001: sck0 i/o (sci) 011: irq0 input (intc) 100: a2 output (bsc) * 2 111: poe2 input (poe) other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 755 of 1080 rej09b0230-0300 bit bit name initial value r/w description 6 5 4 pa1md2 pa1md1 pa1md0 0 * 1 0 0 r/w r/w r/w pa1 mode select the function of the pa1/a1/ poe1 /txd0 pin. 000: pa1 i/o (port) 001: txd0 output (sci) 100: a1 output (bsc) * 2 111: poe1 input (poe) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pa0md2 pa0md1 pa0md0 0 * 1 0 0 r/w r/w r/w pa0 mode select the function of the pa0/a0/ poe0 /rxd0 pin. 000: pa0 i/o (port) 001: rxd0 input (sci) 100: a0 output (bsc) * 2 111: poe0 input (poe) other than above: setting prohibited notes: 1 . the initial value is 1 in the on-chip rom disabled external-extension mode. 2. this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 756 of 1080 rej09b0230-0300 18.1.3 port b i/o register l (pbiorl) pbiorl is a 16-bit readable/writable register that is used to set the pins on port b as inputs or outputs. bits pb7ior to pb0ior correspond to pi ns pb7 to pb0 (names of multiplexed pins are here given as port names and pin numbers alone). pbiorl is enabled when the port b pins are functioning as general-purpose inputs/outputs (pb7 to pb0). in other states, pbiorl is disabled. a given pin on port b will be an output pin if the corresponding bit in pbiorl is set to 1, and an input pin if the bit is cleared to 0. bits 15 to 8 in pbiorl are rese rved. these bits are always read as 0. the write value should always be 0. the initial value of pbiorl is h'0000. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrr/wr/wr/wr/wr/wr/wr/wr/w -------- pb7 ior pb6 ior pb5 ior pb4 ior pb3 ior pb2 ior pb1 ior pb0 ior
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 757 of 1080 rej09b0230-0300 18.1.4 port b control registers l1, l2 (pbcrl1, pbcrl2) pbcrl1 and pbcrl2 are 16-bit readable/writable regi sters that are used to select the function of the multiplexed pins on port b. ? port b control register l2 (pbcrl2) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w - pb7 md2 pb7 md1 pb7 md0 - pb6 md2 pb6 md1 pb6 md0 - pb5 md2 pb5 md1 pb5 md0 - pb4 md2 pb4 md1 pb4 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pb7md2 pb7md1 pb7md0 0 0 0 r/w r/w r/w pb7 mode select the function of the pb7/ cs1 /crx0 pin. 000: pb7 i/o (port) 101: cs1 output (bsc) * 110: crx0 input (rcan-et) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 pb6md2 pb6md1 pb6md0 0 0 0 r/w r/w r/w pb6 mode select the function of the pb6/ wait /ctx0 pin. 000: pb6 i/o (port) 101: wait input (bsc) * 110: ctx0 output (rcan-et) other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 758 of 1080 rej09b0230-0300 bit bit name initial value r/w description 6 5 4 pb5md2 pb5md1 pb5md0 0 0 0 r/w r/w r/w pb5 mode select the function of the pb5/a19/irq3/ poe5 pin. 000: pb5 i/o (port) 001: irq3 input (intc) 101: a19 output (bsc) * 111: poe5 input (poe) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pb4md2 pb4md1 pb4md0 0 0 0 r/w r/w r/w pb4 mode select the function of the pb4/a18/irq2/ poe4 /tic5us pin. 000: pb4 i/o (port) 001: irq2 input (intc) 011: tic5us input (mtu2s) 101: a18 output (bsc) * 111: poe4 input (poe) other than above: setting prohibited note: * this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 759 of 1080 rej09b0230-0300 ? port b control register l1 (pbcrl1) bit: initial value: r/w: 151413121110987654321 0 00 * 1 00 * 1 00 * 1 00 * 1 00000000 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w note: the initial value is 1 in the on-chip rom disabled external-extension mode. 1. - pb3 md2 pb3 md1 pb3 md0 - pb2 md2 pb2 md1 pb2 md0 - pb1 md2 pb1 md1 pb1 md0 - pb0 md2 pb0 md1 pb0 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pb3md2 pb3md1 pb3md0 0 * 1 0 0 * 1 r/w r/w r/w pb3 mode select the function of the pb3/a17/irq1/ poe1 pin. 000: pb3 i/o (port) 001: irq1 input (intc) 010: poe1 input (poe) 101: a17 output (bsc) * 3 other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 pb2md2 pb2md1 pb2md0 0 * 1 0 0 * 1 r/w r/w r/w pb2 mode select the function of the pb2/a16/irq0/ poe0 /tic5vs pin. 000: pb2 i/o (port) 001: irq0 input (intc) 010: poe0 input (poe) 011: tic5vs input (mtu2s) 101: a16 output (bsc) * 3 other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 760 of 1080 rej09b0230-0300 bit bit name initial value r/w description 6 5 4 pb1md2 pb1md1 pb1md0 0 0 0 r/w r/w r/w pb1 mode select the function of the pb1/ breq pin. 000: pb1 i/o (port) 101: breq input (bsc) * 3 110: crx1 input (rcan-et) * 2 other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pb0md2 pb0md1 pb0md0 0 0 0 r/w r/w r/w pb0 mode select the function of the pb0/ back /tic5ws pin. 000: pb0 i/o (port) 011: tic5ws input (mtu2s) 101: back output (bsc) * 3 110: ctx1 output (rcan-et) * 2 other than above: setting prohibited notes: 1 . the initial value is 1 in the on-chip rom disabled external-extension mode. 2. these bits can be set only for sh7142. 3. this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 761 of 1080 rej09b0230-0300 18.1.5 port d i/o register l (pdiorl) pdiorl is a 16-bit readable/writable register that is used to set the pins on port d as inputs or outputs. bits pd10ior to pd0ior correspond to pins pd10 to pd0 (names of multiplexed pins are here given as port names and pin numbers alone). pdiorl is enabled when the port d pins are functioning as general-purpose inputs/outputs (pd10 to pd0). in other states, pdiorl is disabled. a given pin on port d will be an output pin if the corresponding bit in pdiorl is set to 1, and an input pin if the bit is cleared to 0. however, bits 15 to 11 in pdiorl are disabled. the initial value of pdiorl is h'0000. bit: initial value: r/w: 151413121110987654321 0 00000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 00000 rrrrr ----- pd10 ior pd9 ior pd8 ior pd7 ior pd6 ior pd5 ior pd4 ior pd3 ior pd2 ior pd1 ior pd0 ior
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 762 of 1080 rej09b0230-0300 18.1.6 port d control registers l1 to l3 (pdcrl1 to pdcrl3) pdcrl1 to pdcrl3 are 16-bit readable/writable regist ers that are used to select the functions of the multiplexed pins on port d. ? port d control register l3 (pdcrl3) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrr/wr/wr/wrr/wr/wr/wrr/wr/wr/w ----- pd10 md2 pd10 md1 pd10 md0 - pd9 md2 pd9 md1 pd9 md0 - pd8 md2 pd8 md1 pd8 md0 bit bit name initial value r/w description 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10 9 8 pd10md2 pd10md1 pd10md0 0 0 0 r/w r/w r/w pd10 mode select the function of the pd10/sso pin. 000: pd10 i/o (port) 101: sso i/o (synchronous serial communication unit) other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 5 4 pd9md2 pd9md1 pd9md0 0 0 0 r/w r/w r/w pd9 mode select the function of the pd9/ssi pin. 000: pd9 i/o (port) 101: ssi i/o (synchronous serial communication unit) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 763 of 1080 rej09b0230-0300 bit bit name initial value r/w description 2 1 0 pd8md2 pd8md1 pd8md0 0 0 0 r/w r/w r/w pd8 mode select the function of the pd8/sck2/ssck pin. 000: pd8 i/o (port) 101: ssck i/o (synchronous serial communication unit) 110: sck2 i/o (sci) other than above: setting prohibited ? port d control register l2 (pdcrl2) bit: initial value: r/w: 151413121110987654321 0 0000 * 1 0000 * 1 0000 * 1 0000 * 1 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w note: the initial value is 1 in the on-chip rom disabled external-extension mode. 1. - pd7 md2 pd7 md1 pd7 md0 - pd6 md2 pd6 md1 pd6 md0 - pd5 md2 pd5 md1 pd5 md0 - pd4 md2 pd4 md1 pd4 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pd7md2 pd7md1 pd7md0 0 0 0 * 1 r/w r/w r/w pd7 mode select the function of the pd7/d7/txd2/ scs / audsync pin. 000: pd7 i/o (port) 001: d7 i/o (bsc) * 2 011: audsync output (aud) 101: scs i/o (synchronous serial communication unit) 110: txd2 output (sci) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 764 of 1080 rej09b0230-0300 bit bit name initial value r/w description 10 9 8 pd6md2 pd6md1 pd6md0 0 0 0 * 1 r/w r/w r/w pd6 mode select the function of the pd6/d6/rxd2/audck pin. 000: pd6 i/o (port) 001: d6 i/o (bsc) * 2 011: audck output (aud) 110: rxd2 input (sci) other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 5 4 pd5md2 pd5md1 pd5md0 0 0 0 * 1 r/w r/w r/w pd5 mode select the function of the pd5/d5/sck1/audmd pin. 000: pd5 i/o (port) 001: d5 i/o (bsc) * 2 011: audmd input (aud) 110: sck1 i/o (sci) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pd4md2 pd4md1 pd4md0 0 0 0 * 1 r/w r/w r/w pd4 mode select the function of the pd4/d4/txd1/ audrst pin. 000: pd4 i/o (port) 001: d4 i/o (bsc) * 2 011: audrst input (aud) 110: txd1 output (sci) other than above: setting prohibited notes: 1. the initial value is 1 in the on-chip rom disabled external-extension mode. 2. this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 765 of 1080 rej09b0230-0300 ? port d control register l1 (pdcrl1) bit: initial value: r/w: 151413121110987654321 0 0000 * 1 0000 * 1 0000 * 1 0000 * 1 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w note: the initial value is 1 in the on-chip rom disabled external-extension mode. 1. - pd3 md2 pd3 md1 pd3 md0 - pd2 md2 pd2 md1 pd2 md0 - pd1 md2 pd1 md1 pd1 md0 - pd0 md2 pd0 md1 pd0 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pd3md2 pd3md1 pd3md0 0 0 0 * 1 r/w r/w r/w pd3 mode select the function of the pd3/d3/rxd1/audata3 pin. 000: pd3 i/o (port) 001: d3 i/o (bsc) * 2 011: audata3 output (aud) 110: rxd1 input (sci) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 pd2md2 pd2md1 pd2md0 0 0 0 * 1 r/w r/w r/w pd2 mode select the function of the pd2/d2/sck0/audata2 pin. 000: pd2 i/o (port) 001: d2 i/o (bsc) * 2 011: audata2 output (aud) 110: sck0 i/o (sci) other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 766 of 1080 rej09b0230-0300 bit bit name initial value r/w description 6 5 4 pd1md2 pd1md1 pd1md0 0 0 0 * 1 r/w r/w r/w pd1 mode select the function of the pd1/d1/txd0/audata1 pin. 000: pd1 i/o (port) 001: d1 i/o (bsc) * 2 011: audata1 output (aud) 110: txd0 output (sci) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pd0md2 pd0md1 pd0md0 0 0 0 * 1 r/w r/w r/w pd0 mode select the function of the pd0/d0/rxd0/audata0 pin. 000: pd0 i/o (port) 001: d0 i/o (bsc) * 2 011: audata0 output (aud) 110: rxd0 input (sci) other than above: setting prohibited notes: 1. the initial value is 1 in the on-chip rom disabled external-extension mode. 2. this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 767 of 1080 rej09b0230-0300 18.1.7 port e i/o registers l, h (peiorl, peiorh) peiorl and peiorh are 16-bit readable/writable regi sters that are used to set the pins on port e as inputs or outputs. pe21ior to pe0ior corres pond to pins pe21 to pe0 (names of multiplexed pins are here given as port names and pin numbers alone). peiorl is enabled when the port e pins are functioning as general-purpose inputs/outputs (pe15 to pe0) and the tioc pin is functioning as inputs/outputs of mtu2. in other states, peiorl is disabled. peiorh is enabled when the port e pins are functioning as general-purpose inputs/outputs (pe21 to pe16), and the tioc pin is functioning as inputs/outputs of mtu2s. in other states, peiorh is disabled. a given pin on port e will be an output pin if the corresponding bit in peiorh or peiorl is set to 1, and an input pin if the bit is cleared to 0. however, bits 15 to 6 in peiorh are reserved. b its 15 to 6 in peiorh are reserved. these bits are always read as 0. the write value should always be 0. the initial values of peiorl and peiorh are h'0000, respectively. ? port e i/o registers h (peiorh) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrrrr/wr/wr/wr/wr/wr/w ---------- pe21 ior pe20 ior pe19 ior pe18 ior pe17 ior pe16 ior ? port e i/o registers l (peiorl) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w pe15 ior pe14 ior pe13 ior pe12 ior pe11 ior pe10 ior pe9 ior pe8 ior pe7 ior pe6 ior pe5 ior pe4 ior pe3 ior pe2 ior pe1 ior pe0 ior
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 768 of 1080 rej09b0230-0300 18.1.8 port e control registers l1 to l4, h1, h2 (pecrl1 to pecrl4, pecrh1, pecrh2) pecrl1 to pecrl4, pecrh1 and pecrh2 are 16-b it readable/writable regi sters that are used to select the functions of the multiplexed pins on port e. ? port e control register h2 (pecrh2) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrrrr/wr/wrrr/wr/w ---------- pe21 md1 pe21 md0 -- pe20 md1 pe20 md0 bit bit name initial value r/w description 15 to 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 4 pe21md1 pe21md0 0 0 r/w r/w pe21 mode select the function of the pe21/ wrl /tioc4ds pin. 00: pe21 i/o (port) 01: tioc4ds i/o (mtu2s) 10: wrl output (bsc) * other than above: setting prohibited 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 pe20md1 pe20md0 0 0 r/w r/w pe20 mode select the function of the pe20/tioc4cs pin. 00: pe20 i/o (port) 01: tioc4cs i/o (mtu2s) other than above: setting prohibited note: * this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 769 of 1080 rej09b0230-0300 ? port e control register h1 (pecrh1) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r r r/w r/w r r r/w r/w r r r/w r/w r r/w r/w r/w -- pe19 md1 pe19 md0 -- pe18 md1 pe18 md0 -- pe17 md1 pe17 md0 - pe16 md2 pe16 md1 pe16 md0 bit bit name initial value r/w description 15, 14 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 13 12 pe19md1 pe19md0 0 0 r/w r/w pe19 mode select the function of the pe19/ rd /tioc4bs pin. 00: pe19 i/o (port) 01: tioc4bs i/o (mtu2s) 10: rd output (bsc) * other than above: setting prohibited 11, 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 8 pe18md1 pe18md0 0 0 r/w r/w pe18 mode select the function of the pe18/ cs1 /tioc4as pin. 00: pe18 i/o (port) 01: tioc4as i/o (mtu2s) 10: cs1 output (bsc) * other than above: setting prohibited 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 4 pe17md1 pe17md0 0 0 r/w r/w pe17 mode select the function of the pe17/ cs0 /tioc3ds pin. 00: pe17 i/o (port) 01: tioc3ds i/o (mtu2s) 10: cs0 output (bsc) * other than above: setting prohibited
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 770 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pe16md2 pe16md1 pe16md0 0 0 0 r/w r/w r/w pe16 mode select the function of the pe16/ wait /tioc3bs pin. 000: pe16 i/o (port) 001: tioc3bs i/o (mtu2s) 010: wait input (bsc) * other than above: setting prohibited note: * this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode. ? port e control register l4 (pecrl4) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r r/w r/w r/w r r/w r/w r/w r r r/w r/w r r/w r/w r/w - pe15 md2 pe15 md1 pe15 md0 - pe14 md2 pe14 md1 pe14 md0 -- pe13 md1 pe13 md0 - pe12 md2 pe12 md1 pe12 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pe15md2 pe15md1 pe15md0 0 0 0 r/w r/w r/w pe15 mode select the function of the pe15/tioc4d/ irqout pin. 000: pe15 i/o (port) 001: tioc4d i/o (mtu2) 011: irqout output (intc) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 771 of 1080 rej09b0230-0300 bit bit name initial value r/w description 10 9 8 pe14md2 pe14md1 pe14md0 0 0 0 r/w r/w r/w pe14 mode select the function of the pe14/tioc4c pin. 000: pe14 i/o (port) 001: tioc4c i/o (mtu2) other than above: setting prohibited 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 4 pe13md1 pe13md0 0 0 r/w r/w pe13 mode select the function of the pe13/tioc4b/ mres pin. 00: pe13 i/o (port) 01: tioc4b i/o (mtu2) 10: mres input (intc) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pe12md2 pe12md1 pe12md0 0 0 0 r/w r/w r/w pe12 mode select the function of the pe12/tioc4a pin. 000: pe12 i/o (port) 001: tioc4a i/o (mtu2) other than above: setting prohibited
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 772 of 1080 rej09b0230-0300 ? port e control register l3 (pecrl3) bit: initial value: r/w: 151413121110987654321 0 000000 * 1 00000000 * 1 00 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w note: the initial value is 1 in the on-chip rom disabled external-extension mode. 1. - pe11 md2 pe11 md1 pe11 md0 - pe10 md2 pe10 md1 pe10 md0 - pe9 md2 pe9 md1 pe9 md0 - pe8 md2 pe8 md1 pe8 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pe11md2 pe11md1 pe11md0 0 0 0 r/w r/w r/w pe11 mode select the function of the pe11/tioc3d pin. 000: pe11 i/o (port) 001: tioc3d i/o (mtu2) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 pe10md2 pe10md1 pe10md0 0 * 1 0 0 r/w r/w r/w pe10 mode select the function of the pe10/ cs0 /tioc3c pin. 000: pe10 i/o (port) 001: tioc3c i/o (mtu2) 100: cs0 output (bsc) * 2 other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 5 4 pe9md2 pe9md1 pe9md0 0 0 0 r/w r/w r/w pe9 mode select the function of the pe9/tioc3b pin. 000: pe9 i/o (port) 001: tioc3b i/o (mtu2) other than above: setting prohibited
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 773 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pe8md2 pe8md1 pe8md0 0 * 1 0 0 r/w r/w r/w pe8 mode select the function of the pe8/a15/tioc3a pin. 000: pe8 i/o (port) 001: tioc3a i/o (mtu2) 100: a15 output (bsc) * 2 other than above: setting prohibited notes: 1. the initial value is 1 in the on-chip rom disabled external-extension mode. 2. this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode. ? port e control register l2 (pecrl2) bit: initial value: r/w: 151413121110987654321 0 00 * 1 0000 * 1 0000 * 1 0000 * 1 00 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w note: the initial value is 1 in the on-chip rom disabled external-extension mode. 1. - pe7 md2 pe7 md1 pe7 md0 - pe6 md2 pe6 md1 pe6 md0 - pe5 md2 pe5 md1 pe5 md0 - pe4 md2 pe4 md1 pe4 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pe7md2 pe7md1 pe7md0 0 * 1 0 0 r/w r/w r/w pe7 mode select the function of the pe7/a14/tioc2b pin. 000: pe7 i/o (port) 001: tioc2b i/o (mtu2) 100: a14 output (bsc) * 2 other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 774 of 1080 rej09b0230-0300 bit bit name initial value r/w description 10 9 8 pe6md2 pe6md1 pe6md0 0 * 1 0 0 r/w r/w r/w pe6 mode select the function of the pe6/a13/tioc2a/sck1 pin. 000: pe6 i/o (port) 001: tioc2a i/o (mtu2) 100: a13 output (bsc) * 2 110: sck1 i/o (sci) other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 5 4 pe5md2 pe5md1 pe5md0 0 * 1 0 0 r/w r/w r/w pe5 mode select the function of the pe5/a12/tioc1b/txd1 pin. 000: pe5 i/o (port) 001: tioc1b i/o (mtu2) 100: a12 output (bsc) * 2 110: txd1 output (sci) other than above: setting prohibited 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 1 0 pe4md2 pe4md1 pe4md0 0 * 1 0 0 r/w r/w r/w pe4 mode select the function of the pe4/a11/tioc1a/rxd1 pin. 000: pe4 i/o (port) 001: tioc1a i/o (mtu2) 100: a11 output (bsc) * 2 110: rxd1 input (sci) other than above: setting prohibited notes: 1. the initial value is 1 in the on-chip rom disabled external-extension mode. 2. this function is enabled only in the on-chip rom enabled/disabled external-extension mode. do not set 1 in single-chip mode.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 775 of 1080 rej09b0230-0300 ? port e control register l1 (pecrl1) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r r/w r/w r/w r r/w r/w r/w r r/w r/w r/w r r r/w r/w - pe3 md2 pe3 md1 pe3 md0 - pe2 md2 pe2 md1 pe2 md0 - pe1 md2 pe1 md1 pe1 md0 -- pe0 md1 pe0 md0 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 13 12 pe3md2 pe3md1 pe3md0 0 0 0 r/w r/w r/w pe3 mode select the function of the pe3/tioc0d/sck0 pin. 000: pe3 i/o (port) 001: tioc0d i/o (mtu2) 110: sck0 i/o (sci) other than above: setting prohibited 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 pe2md2 pe2md1 pe2md0 0 0 0 r/w r/w r/w pe2 mode select the function of the pe2/tioc0c/txd0 pin. 000: pe2 i/o (port) 001: tioc0c i/o (mtu2) 110: txd0 output (sci) other than above: setting prohibited 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 5 4 pe1md2 pe1md1 pe1md0 0 0 0 r/w r/w r/w pe1 mode select the function of the pe1/tioc0b/rxd0 pin. 000: pe1 i/o (port) 001: tioc0b i/o (mtu2) 110: rxd0 input (sci) other than above: setting prohibited
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 776 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 pe0md1 pe0md0 0 0 r/w r/w pe0 mode select the function of the pe0/tioc0a pin. 00: pe0 i/o (port) 01: tioc0a i/o (mtu2) other than above: setting prohibited
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 777 of 1080 rej09b0230-0300 18.2 usage notes 1. in this lsi, the same function is availabl e as a multiplexed function on multiple pins. this approach is intended to increase the number of selectable pin functions and to allow the easier design of boards. if two or more pins are specified for one function, however, there are two cautions shown below. ? when the pin function is input signals input to several pins are formed as one signal through or or and logic and the signal is transmitted into the lsi. therefore, a signal that differs from the input signals may be transmitted to the lsi depending on the input signals in other pins that have the same functions. table 18.7 shows the transmit forms of input functions allocated to several pins. when using one of the functions shown below in multiple pins, use it with care of signal polarity considering the transmit forms. table 18.7 transmit forms of input functions allocated to multiple pins or type and type sck0 to sck2, rxd0 to rxd2, sso, ssi, ssck irq0 to irq3, wait , scs , poe0 , poe1 , poe4 , poe5 or type: signals input to several pins are formed as one signal through or logic and the signal is transmitted into the lsi. and type: signals input to several pins are formed as one signal through and logic and the signal is transmitted into the lsi. ? when the pin function is output each selected pin can output the same function. 2. when the port input is switched from a low level to the irq edge for the pins that are multiplexed with input/output and irq, the corresponding edge is detected. 3. do not set functions other than those specified in table 18.5. otherwise, correct operation cannot be guaranteed. 4. pfc setting in single-chip mode (mcu operating mode 3) in single-chip mode, do not set the pfc to select address bus, data bus, bus control, or the breq , back , ck, dack, or tend signals. if they are selected, address bus signals function as high- or low-level outputs, data bus signals function as high-impedance outputs, and the other output signals function as high-level outputs. as breq and wait function as inputs, do not leave them open. however, the bus-mastership-request inputs and external waits are disabled.
section 18 pin function controller (pfc) rev. 3.00 oct. 06, 2008 page 778 of 1080 rej09b0230-0300
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 779 of 1080 rej09b0230-0300 section 19 i/o ports this lsi has four ports: a, b, d, and e. port a is a 16-bit port, port b is an 8-bit port, port d is an 11-bit port, and port e is a 22-bit port. all the port pins are multiplexed as general input/output pins and special function pins. the functions of the multiplex pins are selected by the pin function controller (pfc). each port is provided with a data register for storing the pin data.
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 780 of 1080 rej09b0230-0300 19.1 port a port a is an input/output port with the 16 pins shown in figure 19.1. pa15 (i/o)/ ck (output)/ txd1 (output)/ sso (i/o) pa14 (i/o)/ a10 (output)/ rxd1 (input)/ ssi (i/o) pa13 (i/o)/ a9 (output)/ sck1 (i/o)/ ssck (i/o) pa12 (i/o)/ a8 (output)/ sck0 (i/o)/ scs (i/o) pa11 (i/o)/ a7 (output)/ txd0 (output)/ adtrg (input) pa10 (i/o)/ a6 (output)/ rxd0 (input) pa9 (i/o)/ wait (input)/ tclkd (input)/ poe8 (input)/ txd2 (output) pa8 (i/o)/ wrl (output)/ tclkc (input)/ poe6 (input)/ rxd2 (input) pa7 (i/o)/ tclkb (input)/ poe5 (input)/ sck2 (i/o) pa6 (i/o)/ rd (output)/ ubctrg (output)/ tclka (input)/ poe4 (input) pa5 (i/o)/ a5 (output)/ irq3 (input)/ sck1 (i/o) pa4 (i/o)/ a4 (output)/ irq2 (input)/ txd1 (output) pa3 (i/o)/ a3 (output)/ irq1 (input)/ rxd1 (input) pa2 (i/o)/ a2 (output)/ irq0 (input)/ poe2 (input)/ sck0 (i/o) pa1 (i/o)/ a1 (output)/ poe1 (input)/ txd0 (output) pa0 (i/o)/ a0 (output)/ poe0 (input)/ rxd0 (input) port a figure 19.1 port a
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 781 of 1080 rej09b0230-0300 19.1.1 register descriptions port a is a 16-bit input/output port. port a has the following registers. for details on register addresses and register states during each processi ng, refer to section 24, list of registers. table 19.1 register configuration register name abbrevia- tion r/w initial value address access size port a data register l padrl r/w h'0000 h'ffffd102 8, 16 port a port register l paprl r h'xxxx h'ffffd11e 8, 16 19.1.2 port a data register l (padrl) padrl is a 16-bit readable/writable register th at stores port a data. bits pa15dr to pa0dr correspond to pins pa15 to pa0 (multiplexed functions omitted here). when a pin function is general output, if a value is written to padrl, that value is output directly from the pin, and if padrl is read, the register value is returned directly regardless of the pin state. when a pin function is general input, if padrl is read, the pin state, not the register value, is returned directly. if a value is written to padrl, a lthough that valu e is written into padrl, it does not affect the pin state. table 19.2 summarizes port a data register read/write operations. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w pa15 dr pa14 dr pa13 dr pa12 dr pa11 dr pa10 dr pa 9 dr pa 8 dr pa 7 dr pa 6 dr pa 5 dr pa 4 dr pa 3 dr pa 2 dr pa 1 dr pa 0 dr
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 782 of 1080 rej09b0230-0300 bit bit name initial value r/w description 15 pa15dr 0 r/w see table 19.2 14 pa14dr 0 r/w 13 pa13dr 0 r/w 12 pa12dr 0 r/w 11 pa11dr 0 r/w 10 pa10dr 0 r/w 9 pa9dr 0 r/w 8 pa8dr 0 r/w 7 pa7dr 0 r/w 6 pa6dr 0 r/w 5 pa5dr 0 r/w 4 pa4dr 0 r/w 3 pa3dr 0 r/w 2 pa2dr 0 r/w 1 pa1dr 0 r/w 0 pa0dr 0 r/w table 19.2 port a data register l (padrl) read/write operations ? bits 15 to 0 in padrl paior pin function read write 0 general input pin state can write to padrl, but it has no effect on pin state other than general input pin state can write to padrl, but it has no effect on pin state 1 general output padrl value value written is output from pin other than general output padrl value can write to padrl, but it has no effect on pin state
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 783 of 1080 rej09b0230-0300 19.1.3 port a port register l (paprl) paprl is a 16-bit read-only register that always returns the states of the pins regardless of the pfc setting. bits pa15pr to pa0pr correspond to pins pa15 to pa0 (multiplexed functions omitted here). bit: initial value: r/w: 151413121110987654321 0 **************** rrrrrrrrrrrrrrrr pa15 pr pa14 pr pa13 pr pa12 pr pa11 pr pa10 pr pa 9 pr pa 8 pr pa 7 pr pa 6 pr pa 5 pr pa 4 pr pa 3 pr pa 2 pr pa 1 pr pa 0 pr bit bit name initial value r/w description 15 pa15pr pin state r 14 pa14pr pin state r the pin state is returned regardless of the pfc setting. these bits cannot be modified. 13 pa13pr pin state r 12 pa12pr pin state r 11 pa11pr pin state r 10 pa10pr pin state r 9 pa9pr pin state r 8 pa8pr pin state r 7 pa7pr pin state r 6 pa6pr pin state r 5 pa5pr pin state r 4 pa4pr pin state r 3 pa3pr pin state r 2 pa2pr pin state r 1 pa1pr pin state r 0 pa0pr pin state r
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 784 of 1080 rej09b0230-0300 19.2 port b port b is an input/output port with the 8 pins shown in figure 19.2. pb7 (i/o)/ cs1 (output)/ crx0 (input) pb6 (i/o)/ wait (input)/ ctx0 (output) pb5 (i/o)/ a19 (output)/ irq3 (input)/ poe5 (input) pb4 (i/o)/ a18 (output)/ irq2 (input)/ poe4 (input)/ tic5us (input) pb3 (i/o)/ a17 (output)/ irq1 (input)/ poe1 (input) pb2 (i/o)/ a16 (output)/ irq0 (input)/ poe0 (input)/ tic5vs (input) pb1 (i/o)/ breq (input)/crx1 (input) * pb0 (i/o)/ back (output)/ tic5ws (input)/ctx1 (output) * port b note: * available only in the sh7142. figure 19.2 port b 19.2.1 register descriptions port b is an 8-bit input/output port. port b has the following register. for details on register addresses and register states during each processi ng, refer to section 24, list of registers. table 19.3 register configuration register name abbrevia- tion r/w initial value address access size port b data register l pbdrl r/w h'0000 h'ffffd182 8, 16 port b port register l pbprl r h'00xx h'ffffd19e 8, 16
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 785 of 1080 rej09b0230-0300 19.2.2 port b data register l (pbdrl) pbdrl is a 16-bit readable/writable register th at stores port b data. bits pb7dr to pb0dr correspond to pins pb7 to pb0 (multiplexed functions omitted here). when a pin function is general output, if a value is written to pbdrl, that value is output directly from the pin, and if pbdrl is read, the register value is returned directly regardless of the pin state. when a pin function is general input, if pbdrl is read, the pin state, not the register value, is returned directly. if a value is written to pbdrl, a lthough that valu e is written into pbdrl, it does not affect the pin state. table 19.4 summarizes port b data register read/write operations. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrr/wr/wr/wr/wr/wr/wr/wr/w -------- pb7 dr pb6 dr pb5 dr pb4 dr pb3 dr pb2 dr pb1 dr pb0 dr bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 pb7dr 0 r/w see table 19.4 6 pb6dr 0 r/w 5 pb5dr 0 r/w 4 pb4dr 0 r/w 3 pb3dr 0 r/w 2 pb2dr 0 r/w 1 pb1dr 0 r/w 0 pb0dr 0 r/w
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 786 of 1080 rej09b0230-0300 table 19.4 port b data register l (pbdrl) read/write operations ? bits 7 to 0 in pbdrl pbior pin function read write 0 general input pin state can write to pbdrl, but it has no effect on pin state other than general input pin state can write to pbdrl, but it has no effect on pin state 1 general output pbdrl value value written is output from pin other than general output pbdrl value can write to pbdrl, but it has no effect on pin state 19.2.3 port b port register l (pbprl) pbprl is a 16-bit read-only register that always returns the states of the pins regardless of the pfc setting. bits pb7pr to pb0pr correspond to pins pb7 to pb0 (multiplexed functions omitted here). bit: initial value: r/w: 151413121110987654321 0 00000000 ******** rrrrrrrrrrrrrrrr -------- pb7 pr pb6 pr pb5 pr pb4 pr pb3 pr pb2 pr pb1 pr pb0 pr bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 pb7pr pin state r 6 pb6pr pin state r 5 pb5pr pin state r 4 pb4pr pin state r 3 pb3pr pin state r 2 pb2pr pin state r 1 pb1pr pin state r the pin state is returned regardless of the pfc setting. these bits cannot be modified. 0 pb0pr pin state r
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 787 of 1080 rej09b0230-0300 19.3 port d port d is an input/output port with the 11 pins shown in figure 19.3. pd10 (i/o)/sso (i/o) pd9 (i/o)/ssi (i/o) pd8 (i/o)/sck2 (i/o)/ssck (i/o) pd7 (i/o)/d7 (i/o)/txd2 (output)/ scs (i/o)/ audsync (output) pd6 (i/o)/d6 (i/o)/rxd2 (input)/audck (output) pd5 (i/o)/d5 (i/o)/sck1 (i/o)/audmd (input) pd4 (i/o)/d4 (i/o)/txd1 (output)/ audrst (input) pd3 (i/o)/d3 (i/o)/rxd1 (input)/audata3 (output) pd2 (i/o)/d2 (i/o)/sck0 (i/o)/audata2 (output) pd1 (i/o)/d1 (i/o)/txd0 (output)/audata1 (output) pd0 (i/o)/d0 (i/o)/rxd0 (input)/audata0 (output) port d figure 19.3 port d 19.3.1 register descriptions port d is an 11-bit input/output port. port d has the following registers. for details on register addresses and register states during each processi ng, refer to section 24, list of registers. table 19.5 register configuration register name abbrevia- tion r/w initial value address access size port d data register l pddrl r/w h'0000 h'ffffd282 8, 16 port d port register l pdprl r h'0xxx h'ffffd29e 8, 16
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 788 of 1080 rej09b0230-0300 19.3.2 port d data register l (pddrl) pddrl is a 16-bit readable/writable register th at stores port d data. bits pd10dr to pd0dr correspond to pins pd10 to pd0 (multiplexed functions omitted here). when a pin function is general output, if a value is written to pddrl, that value is output directly from the pin, and if pddrl is read, the register value is returned directly regardless of the pin state. when a pin function is general input, if pddrl is read, the pin state, not the register value, is returned directly. if a value is written to pddrl, a lthough that valu e is written into pddrl, it does not affect the pin state. table 19.6 summarizes port d data register read/write operations. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/w ----- pd10 dr pd9 dr pd8 dr pd7 dr pd6 dr pd5 dr pd4 dr pd3 dr pd2 dr pd1 dr pd0 dr bit bit name initial value r/w description 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10 pd10dr 0 r/w see table 19.6 9 pd9dr 0 r/w 8 pd8dr 0 r/w 7 pd7dr 0 r/w 6 pd6dr 0 r/w 5 pd5dr 0 r/w 4 pd4dr 0 r/w 3 pd3dr 0 r/w 2 pd2dr 0 r/w 1 pd1dr 0 r/w 0 pd0dr 0 r/w
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 789 of 1080 rej09b0230-0300 table 19.6 port d data register l (pddrl) read/write operations ? bits 15 to 0 in pddrl pdior pin function read write 0 general input pin state can write to pddrl, but it has no effect on pin state other than general input pin state can write to pddrl, but it has no effect on pin state 1 general output pddrl value value written is output from pin other than general output pddrl value can write to pddrl, but it has no effect on pin state
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 790 of 1080 rej09b0230-0300 19.3.3 port d port register l (pdprl) pdprl is a 16-bit read-only register that always returns the states of the pins regardless of the pfc setting. bits pd10pr to pd0pr correspond to pins pd10 to pd0 (multiplexed functions omitted here). bit: initial value: r/w: 151413121110987654321 0 00000 *********** rrrrrrrrrrrrrrrr ----- pd10 pr pd9 pr pd8 pr pd7 pr pd6 pr pd5 pr pd4 pr pd3 pr pd2 pr pd1 pr pd0 pr bit bit name initial value r/w description 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10 pd10pr pin state r 9 pd9pr pin state r 8 pd8pr pin state r 7 pd7pr pin state r 6 pd6pr pin state r 5 pd5pr pin state r 4 pd4pr pin state r 3 pd3pr pin state r 2 pd2pr pin state r 1 pd1pr pin state r the pin state is returned regardless of the pfc setting. these bits cannot be modified. 0 pd0pr pin state r
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 791 of 1080 rej09b0230-0300 19.4 port e port e is an input/output port with the 22 pins shown in figure 19.4. pe15 (i/o)/ tioc4d (i/o)/ irqout (output) pe14 (i/o)/ tioc4c (i/o) pe13 (i/o)/ tioc4b (i/o)/ mres (input) pe12 (i/o)/ tioc4a (i/o) pe11 (i/o)/ tioc3d (i/o) pe10 (i/o)/ cs0 (output)/ tioc3c (i/o) pe9 (i/o)/ tioc3b (i/o) pe8 (i/o)/ a15 (output)/ tioc3a (i/o) pe7 (i/o)/ a14 (output)/ tioc2b (i/o) pe6 (i/o)/ a13 (output)/ tioc2a (i/o)/ sck1 (i/o) pe21 (i/o)/ wrl (output)/ tioc4ds (i/o) pe20 (i/o)/ tioc4cs (i/o) pe19 (i/o)/ rd (output)/ tioc4bs (i/o) pe18 (i/o)/ cs1 (output)/ tioc4as (i/o) pe17 (i/o)/ cs0 (output)/ tioc3ds (i/o) pe16 (i/o)/ wait (input)/ tioc3bs (i/o) pe5 (i/o)/ a12 (output)/ tioc1b (i/o)/ txd1 (output) pe4 (i/o)/ a11 (output)/ tioc1a (i/o)/ rxd1 (input) pe3 (i/o)/ tioc0d (i/o)/ sck0 (i/o) pe2 (i/o)/ tioc0c (i/o)/ txd0 (output) pe1 (i/o)/ tioc0b (i/o)/ rxd0 (input) pe0 (i/o)/ tioc0a (i/o) port e figure 19.4 port e
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 792 of 1080 rej09b0230-0300 19.4.1 register descriptions port e is a 22-bit input/output port. port e has the following registers. for details on register addresses and register states during each processi ng, refer to section 24, list of registers. table 19.7 register configuration register name abbrevia- tion r/w initial value address access size port e data register h pedrh r/w h'0000 h'ffffd300 8, 16, 32 port e data register l pedrl r/w h'0000 h'ffffd302 8, 16 port e port register h peprh r h'00xx h'ffffd31c 8, 16, 32 port e port register l peprl r h'xxxx h'ffffd31e 8, 16 19.4.2 port e data registers h and l (pedrh and pedrl) pedrh and pedrl are 16-bit readable/writable registers that store port e data. bits pe21dr to pe0dr correspond to pins pe21 to pe0 (multiplexed functions omitted here). when a pin function is general output, if a value is written to pedrh or pedrl, that value is output directly from the pin, and if pedrh or pedrl is read, the register value is returned directly regardless of the pin state. when a pin function is general input, if pedrh or pedrl is read, the pin state, not the register value, is returned directly. if a value is written to pedrh or pedrl, although that value is written into pedrh or pedrl, it does not affect the pin state. table 19.8 summarizes port e data register read/write operations.
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 793 of 1080 rej09b0230-0300 ? port e data register h (pedrh) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrrrr/wr/wr/wr/wr/wr/w ---------- pe21 dr pe20 dr pe19 dr pe18 dr pe17 dr pe16 dr bit bit name initial value r/w description 15 to 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 pe21dr 0 r/w see table 19.8 4 pe20dr 0 r/w 3 pe19dr 0 r/w 2 pe18dr 0 r/w 1 pe17dr 0 r/w 0 pe16dr 0 r/w
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 794 of 1080 rej09b0230-0300 ? port e data register l (pedrl) bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w pe15 dr pe14 dr pe13 dr pe12 dr pe11 dr pe10 dr pe9 dr pe8 dr pe7 dr pe6 dr pe5 dr pe4 dr pe3 dr pe2 dr pe1 dr pe0 dr bit bit name initial value r/w description 15 pe15dr 0 r/w see table 19.8 14 pe14dr 0 r/w 13 pe13dr 0 r/w 12 pe12dr 0 r/w 11 pe11dr 0 r/w 10 pe10dr 0 r/w 9 pe9dr 0 r/w 8 pe8dr 0 r/w 7 pe7dr 0 r/w 6 pe6dr 0 r/w 5 pe5dr 0 r/w 4 pe4dr 0 r/w 3 pe3dr 0 r/w 2 pe2dr 0 r/w 1 pe1dr 0 r/w 0 pe0dr 0 r/w
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 795 of 1080 rej09b0230-0300 table 19.8 port e data register (pedr) read/write operations ? bits 5 to 0 in pedrh and bits 15 to 0 in pedrl peior pin function read write 0 general input pin state can write to pedrh and pedrl, but it has no effect on pin state other than general input pin state can write to pedrh and pedrl, but it has no effect on pin state 1 general output pedrh or pedrl value value written is output from pin other than general output pedrh or pedrl value can write to pedrh and pedrl, but it has no effect on pin state 19.4.3 port e port registers h and l (peprh and peprl) peprh and peprl are 16-bit read-only registers th at always return the states of the pins regardless of the pfc setting. bits pe21pr to pe0pr correspond to pins pe21 to pe0 (multiplexed functions omitted here). ? port e port register h (peprh) bit: initial value: r/w: 151413121110987654321 0 0000000000 ****** rrrrrrrrrrrrrrrr ---------- pe21 pr pe20 pr pe19 pr pe18 pr pe17 pr pe16 pr bit bit name initial value r/w description 15 to 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 pe21pr pin state r 4 pe20pr pin state r 3 pe19pr pin state r 2 pe18pr pin state r 1 pe17pr pin state r the pin state is returned regardless of the pfc setting. these bits cannot be modified. 0 pe16pr pin state r
section 19 i/o ports rev. 3.00 oct. 06, 2008 page 796 of 1080 rej09b0230-0300 ? port e port register l (peprl) bit: initial value: r/w: 151413121110987654321 0 **************** rrrrrrrrrrrrrrrr pe15 pr pe14 pr pe13 pr pe12 pr pe11 pr pe10 pr pe9 pr pe8 pr pe7 pr pe6 pr pe5 pr pe4 pr pe3 pr pe2 pr pe1 pr pe0 pr bit bit name initial value r/w description 15 pe15pr pin state r 14 pe14pr pin state r 13 pe13pr pin state r 12 pe12pr pin state r 11 pe11pr pin state r 10 pe10pr pin state r 9 pe9pr pin state r 8 pe8pr pin state r 7 pe7pr pin state r 6 pe6pr pin state r 5 pe5pr pin state r 4 pe4pr pin state r 3 pe3pr pin state r 2 pe2pr pin state r 1 pe1pr pin state r the pin state is returned regardless of the pfc setting. these bits cannot be modified. 0 pe0pr pin state r
section 20 flash memory rev. 3.00 oct. 06, 2008 page 797 of 1080 rej09b0230-0300 section 20 flash memory this lsi has 512 kbytes/384 kbytes/256 kbytes* of on-chip flash memory. the flash memory has the following features. 20.1 features ? two flash-memory mats, with one selected by the mode in which the lsi starts up the on-chip flash memory has two memory sp aces in the same address space (hereafter referred to as memory mats). the mode setting when the lsi starts up determines the memory mat that is currently mapped. the mat can be switched by bank-switching after the lsi has started up. ? size of the user mat, from which booting- up proceeds after a power-on reset in user mode: 512 kbytes/384 kbytes/256 kbytes* ? size of the user boot mat, from which booting-up proceeds after a power-on reset in user boot mode: 12 kbytes ? three on-board programming modes and one off-board programming mode on-board programming modes boot mode : the on-chip sci interface is used for pr ogramming in this mode. either the user mat or user-boot mat can be programmed, and the bit rate for data transfer between the host and this lsi are auto matically adjusted. user program mode : this mode allows programming of the user mat via any desired interface. user boot mode : this mode allows writing of a user boot program via any desired interface and programming of the user mat. off-board programming mode programmer mode: this mode allows programming of the user mat and user boot mat with the aid of a prom programmer. note: * see the product lineup in section 1.1, features.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 798 of 1080 rej09b0230-0300 ? downloading of an on-chip program to pr ovide an interface for programming/erasure this lsi has a dedicated programming/erasing program. after this program has been downloaded to the on-chip ram, programming or erasing can be performed by setting parameters as arguments. ?user branching? is also supported. ? user branching programming is performed in 128-byte units. each round of programming consists of application of the programming pulse, reading for verification, and several other steps. erasing is performed in block units and each round of erasing consists of several steps. a user- processing routine can be exec uted between each round of eras ing, and making the setting for this is called the addition of a user branch. ? using on-chip ram to emulate flash memory by laying on-chip ram over part of the flash memory, flash-memory programming can be emulated in real time. ? protection modes there are two modes of protection: software protection is applied by register settings and hardware protection is applied by the level on the fwe pin. protection of the flash memory from programming or erasure can be selected. when an abnormal state is de tected, such as runaway execution of programming/erasing, the protection modes initiate the transition to the error protection state and suspend programming/erasing processing. ? programming/erasing time the time taken to program 128 bytes of flash memory in a single round is t p ms (typ.), which is equivalent to t p /128 ms per byte. the erasing time is t e s (typ.) per block. ? number of programming operations the flash memory can be programmed up to n wec times. ? operating frequency for programming/erasing the operating frequency for programming/erasing is a maximum of 40 mhz (p ).
section 20 flash memory rev. 3.00 oct. 06, 2008 page 799 of 1080 rej09b0230-0300 20.2 overview 20.2.1 block diagram fccs fpcs fecs fkey fmats ftdar ramer control unit memory mat unit flash memory user mat: 512 kbytes/ 384 kbytes/ 256 kbytes * user boot mat: 12 kbytes operatin g mode module bus fwe pin mode pins internal address bus internal data bus (32 bits) [le g end] fccs: flash code control and status re g ister fpcs: flash pro g ram code select re g ister fecs: flash erase code select re g ister fkey: flash key code re g ister fmats: flash mat select re g ister ftdar: flash transfer destination address re g ister ramer: ram emulation re g ister note: * see the product lineup in section 1.1, features. figure 20.1 block diagram of flash memory
section 20 flash memory rev. 3.00 oct. 06, 2008 page 800 of 1080 rej09b0230-0300 20.2.2 operating mode when each mode pin and the fwe pin are set in the reset state and the reset signal is released, the microcomputer enters each operati ng mode as shown in figure 20.2. for the setting of each mode pin and the fwe pin, see table 20.1. ? flash memory cannot be read, programmed, or erased in rom invalid mode. the programming/erasing interface re gisters cannot be written to. when these registers are read, h'00 is always read. ? flash memory can be read in user mode, but cannot be programmed or erased. ? flash memory can be read, programmed, or erased on the board only in user program mode, user boot mode, and boot mode. ? flash memory can be read, programmed, or erased by means of the prom programmer in programmer mode. pro g rammer mode reset state rom invalid mode user mode user pro g ram mode user boot mode boot mode on-board pro g rammin g mode fwe = 0 ram emulation is enabled fwe = 1 res = 0 rom invalid mode settin g res = 0 user mode settin g res = 0 user pro g ram mode settin g user boot mode s ettin g res = 0 boot mode settin g res = 0 res = 0 pro g rammer mode settin g figure 20.2 mode transition of flash memory
section 20 flash memory rev. 3.00 oct. 06, 2008 page 801 of 1080 rej09b0230-0300 table 20.1 relationship between fwe and md pins and operating modes pin reset state rom invalid mode user mode user program mode user boot mode boot mode programmer mode res 0 1 1 1 1 1 fwe 0/1 0 0 1 1 1 md0 0/1 0/1 * 1 0/1 * 2 0/1 * 2 1 0 md1 0/1 0 1 1 0 0 setting value depends on the condition of the specialized prom programmer. notes: 1. md0 = 0: 8-bit external bus, md0 = 1: setting prohibited 2. md0 = 0: external bus can be used, md0 = 1: single-chip mode (external bus cannot be used)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 802 of 1080 rej09b0230-0300 20.2.3 mode comparison the comparison table of programming and erasing related items about boot mode, user program mode, user boot mode, and programmer mode is shown in table 20.2. table 20.2 comparison of programming modes boot mode user program mode user boot mode programmer mode programming/ erasing environment on-board programming on-board programming on-board programming off-board programming programming/ erasing enable mat user mat user boot mat user mat user mat user mat user boot mat programming/ erasing control command method programming/ erasing interface programming/ erasing interface ? all erasure possible (automatic) possible possible possible (automatic) block division erasure possible * 1 possible possible not possible program data transfer from host via sci from optional device via ram from optional device via ram via programmer user branch function not possible possible possible not possible ram emulation not possible possible not possible not possible reset initiation mat embedded program storage mat user mat user boot mat * 2 embedded program storage mat transition to user mode mode setting change and reset fwe setting change mode setting change and reset ? notes: 1. all-erasure is performed. after that, the specified block can be erased. 2. initiation starts from the embedded program storage mat. after checking the flash- memory related registers, initiation starts from the reset vector of the user mat. ? the user boot mat can be programmed or erased only in boot mode and programmer mode. ? the user mat and user boot mat are all erased in boot mode. then, the user mat and user boot mat can be programmed by means of the command method. however, the contents of the mat cannot be read until this state. only user boot mat is programmed and the user mat is programmed in user boot mode or only user mat is programmed because user boot mode is not used. ? in user boot mode, the boot operation of the optional interface can be performed by a mode pin setting different from user program mode.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 803 of 1080 rej09b0230-0300 20.2.4 flash memory configuration this lsi's flash memory is configured by the 512 kbytes/384 kbytes/256 kbytes* user mat and 12-kbyte user boot mat. the user mat and user boot mat areas start at the same address. therefore, when the program execution or data access is performed between the two mats, the mat must be switched by using fmats. the user mat or user boot mat can be read in all modes if it is in rom valid mode. however, the user boot mat can be programmed only in boot mode and programmer mode. address h'00000000 address h'00000000 address h'00002fff 512 kby tes/384 kby tes/ 256 kby t es * 12 kbytes note: * see the product lineup in section 1.1, features. address h'0007ffff (when the size of the user mat is 512 kbytes) address h'0003ffff (when the size of the user mat is 256 kbytes) address h'0005ffff (when the size of the user mat is 384 kbytes) figure 20.3 flash memory configuration the user mat and user boot mat have differen t memory sizes. do not access a user boot mat that is 12 kbytes or more. when a user boot mat exceeding 12 kbytes is read from, an undefined value is read.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 804 of 1080 rej09b0230-0300 20.2.5 block division the user mat is divided into 64 kbytes (seven blocks in 512-kbyte product, five blocks in 384- kbyte product, and three blocks in 256-kbyte product), 32 kbytes (one block), and 4 kbytes (eight blocks) as shown in figure 20.4. the user mat can be erased in this divided-block units and the erase-block number of eb0 to eb11 is specified when erasing. the ram emulation can be performed in the eight blocks of 4 kbytes. last address of 512-kbyte product h'0007ffff 64 kbytes 512 kbytes 384 kbytes 32 kbytes 64 kbytes 64 kbytes eb0 eb7 eb8 eb9 eb10 eb11 * 4 kbytes 8 < user mat > erase bloc k 64 kbytes 64 kbytes 64 kbytes 64 kbytes eb12 eb13 eb14 eb15 last address of 384-kbyte product h'0005ffff address h'00000000 256 kbytes last address of 256-kbyte product h'0003ffff note: * ram emulation can be performed in the ei g ht 4-kbyte blocks. to figure 20.4 block division of user mat
section 20 flash memory rev. 3.00 oct. 06, 2008 page 805 of 1080 rej09b0230-0300 20.2.6 programming/erasi ng interface programming/erasing is executed by downloading the on-chip program to the on-chip ram and specifying the program address/data and erase bl ock by using the interface registers/parameters. the procedure program is made by the user in user program mode and user boot mode. the overview of the procedure is as follows. for de tails, see section 20.5.2, user program mode. download on-chip pro g ram by settin g vbr, fkey, and sco bits. initialization execution (on-chip pro g ram execution) select on-chip pro g ram to be downloaded and set download destination pro g rammin g (in 128-byte units) or erasin g (in one-block units) (on-chip pro g ram execution) start user procedure pro g ram for pro g rammin g /erasin g . end user procedure pro g ram pro g rammin g / erasin g completed? no yes figure 20.5 overview of user procedure program
section 20 flash memory rev. 3.00 oct. 06, 2008 page 806 of 1080 rej09b0230-0300 (1) selection of on-chip program to be downloaded and setting of download destination this lsi has programming/erasing programs and they can be downloaded to the on-chip ram. the on-chip program to be downloaded is selected by setting the corresponding bits in the programming/erasing interface registers. the download destination can be specified by ftdar. (2) download of on-chip program the on-chip program is automatically downloaded by clearing vbr of the cpu to h'84000000 and then setting the sco bit in the flash code control and status register (fccs) and the flash key code register (fkey), which are prog ramming/erasing interface registers. the user mat is replaced to the embedded pr ogram storage area when downloading. since the flash memory cannot be read when programming/erasing, the procedure program, which is working from download to completion of programming/erasing, must be executed in a space other than the flash memory to be programme d/erased (for example, on-chip ram). since the result of download is returned to the programming/erasing interface parameters, whether the normal download is executed or not can be confirmed. note that vbr can be changed after download is completed. (3) initialization of programming/erasing the operating frequency and user branch are set before execution of programming/erasing. the user branch destination must be in an area other than the user mat area which is in the middle of programming and the area where the on-chip program is downloaded. these settings are performed by using the programmi ng/erasing interface parameters.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 807 of 1080 rej09b0230-0300 (4) programming/erasing execution to program or erase, the fwe pin must be brought high and user program mode must be entered. the program data/programming destination address is specified in 128-byte units when programming. the block to be erased is specified in erase-block units when erasing. these specifications are set by using the prog ramming/erasing interface parameters and the on- chip program is initiated. the on-chip program is executed by using the jsr or bsr instruction to perform the subroutine call of the specified address in the on-chi p ram. the execution result is returned to the programming/er asing interface parameters. the area to be programmed must be erased in advance when programming flash memory. there are limitations and notes on the interrupt processing during programming/erasing. for details, see section 20.8.2, interrupts during programming/erasing. (5) when programming/erasing is executed consecutively when the processing is not ended by the 128-byte programming or one-block erasure, the program address/data and erase-block number must be updated and consecutive programming/erasing is required. since the downloaded on-chip program is left in the on-chip ram after the processing, download and initialization are not required when the same processing is executed consecutively.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 808 of 1080 rej09b0230-0300 20.3 input/output pins flash memory is controlled by the pins as shown in table 20.3. table 20.3 pin configuration pin name symbol input/output function power-on reset res input reset flash programming enable fwe input hardware protection when programming flash memory mode 1 md1 input sets operating mode of this lsi mode 0 md0 input sets operating mode of this lsi transmit data txd1 (pa4) output serial transmit data output (used in boot mode) receive data rxd1 (pa3) input serial receive data input (used in boot mode) 20.4 register descriptions 20.4.1 registers the registers/parameters which control flash memory when the on-chip flash memory is valid are shown in table 20.4. there are several operating modes for accessing flas h memory, for example, read mode/program mode. there are two memory mats: user mat and user boot mat. the dedicated registers/parameters are allocated for each operating mode and mat se lection. the correspondence of operating modes and registers/parameters for use is shown in table 20.5.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 809 of 1080 rej09b0230-0300 table 20.4 (1) register configuration register name abbreviation * 4 r/w initial value address access size flash code control and status register fccs r, w * 1 h'00 * 2 h'80 * 2 h'ffffcc00 8 flash program code select register fpcs r/w h'00 h'ffffcc01 8 flash erase code select register fecs r/w h'00 h'ffffcc02 8 flash key code register fkey r/w h'00 h'ffffcc04 8 flash mat select register fmats r/w h'00 * 3 h'aa * 3 h'ffffcc05 8 flash transfer destination address register ftdar r/w h'00 h'ffffcc06 8 ram emulation register ramer r/w h'0000 h'fffff108 16 notes: 1. the bits except the sco bit are read-only bits. the sco bit is a programming-only bit. (the value which can be read is always 0.) 2. the initial value of the fwe bit is 0 when the fwe pin goes low. the initial value of the fwe bit is 1 when the fwe pin goes high. 3. the initial value at initiation in user mode or user program mode is h'00. the initial value at initiation in user boot mode is h'aa. 4. all registers except for ramer can be accessed only in bytes. ramer can be accessed in bytes or words. table 20.4 (2) parameter configuration name abbreviation r/w initial value address access size download pass/fail result dpfr r/w undefined on-chip ram * 8, 16, 32 flash pass/fail result fpfr r/w undefined r0 of cpu 8, 16, 32 flash multipurpose address area fmpar r/w undefined r5 of cpu 8, 16, 32 flash multipurpose data destination area fmpdr r/w undefined r4 of cpu 8, 16, 32 flash erase block select febs r/w undefined r4 of cpu 8, 16, 32 flash program and erase frequency control fpefeq r/w undefined r4 of cpu 8, 16, 32 flash user branch address set parameter fubra r/w undefined r5 of cpu 8, 16, 32 note: * one byte of the start address in the on-chip ram area specified by ftdar is valid.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 810 of 1080 rej09b0230-0300 table 20.5 register/parame ter and target mode download initiali- zation program- ming erasure read ram emulation fccs ? ? ? ? ? fpcs ? ? ? ? ? fecs ? ? ? ? ? fkey ? ? ? fmats ? ? * 1 * 1 * 2 ? programming/ erasing interface registers ftdar ? ? ? ? ? dpfr ? ? ? ? ? fpfr ? ? ? fpefeq ? ? ? ? ? fubra ? ? ? ? ? fmpar ? ? ? ? ? fmpdr ? ? ? ? ? programming/ erasing interface parameters febs ? ? ? ? ? ram emulation ramer ? ? ? ? ? notes: 1. the setting is required when programming or erasing user mat in user boot mode. 2. the setting may be required according to the combination of initiation mode and read target mat.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 811 of 1080 rej09b0230-0300 20.4.2 programming/erasing interface registers the programming/erasing interface registers are as described below. they are all 8-bit registers that can be accessed in bytes. (1) flash code control and status register (fccs) fccs is configured by bits which request the monitor of the fwe pin state and error occurrence during programming or erasing flash memory and the download of the on-chip program. bit: initial value: r/w: 7654321 0 1/0 1/0 0 0 0 0 0 0 rrrrrrr(r)/w fwe mat - fler - - - sco bit bit name initial value r/w description 7 fwe 1/0 r flash programming enable monitors the level which is input to the fwe pin that performs hardware protection of the flash memory programming or erasing. the initial value is 0 or 1 according to the fwe pin state. 0: when the fwe pin goes low (in hardware protection state) 1: when the fwe pin goes high 6 mat 1/0 r mat bit indicates whether the user mat or user boot mat is selected. 0: user mat is selected 1: user boot mat is selected 5 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 812 of 1080 rej09b0230-0300 bit bit name initial value r/w description 4 fler 0 r flash memory error indicates an error occurs during programming and erasing flash memory. when fler is set to 1, flash memory enters the error protection state. when fler is set to 1, high voltage is applied to the internal flash memory. to reduce the damage to flash memory, the reset signal must be released after the reset period of 100 s which is longer than normal. 0: flash memory operates normally programming/erasing protection for flash memory (error protection) is invalid. [clearing condition] at a power-on reset or in hardware standby mode 1: indicates an error occurs during programming/erasing flash memory. programming/erasing protection for flash memory (error protection) is valid. [setting condition] see section 20.6.3, error protection. 3 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 813 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 sco 0 (r)/w source program copy operation requests the on-chip programming/erasing program to be downloaded to the on-chip ram. when this bit is set to 1, the on-chip program which is selected by fpcs/fecs is automatically downloaded in the on-chip ram area specified by ftdar. in order to set this bit to 1, ram emulation state must be canceled, h'a5 must be written to fkey, and this operation must be in the on-chip ram. four nop instructions must be executed immediately after setting this bit to 1. for interrupts during download, see section 20.8.2, interrupts during programming/erasing. for the download time, see section 20.8.3, other notes. since this bit is cleared to 0 when download is completed, this bit cannot be read as 1. download by setting the sco bit to 1 requires a special interrupt processing that performs bank switching to the on-chip program storage area. therefore, before issuing a download request (sco = 1), set vbr to h'84000000. otherwise, the cpu gets out of control. once download end is confirmed, vbr can be changed to any other value. the mode in which the fwe pin is high must be used when using the sco function. 0: download of the on-chip programming/erasing program to the on-chip ram is not executed. [clearing condition] when download is completed 1: request that the on-chip programming/erasing program is downloaded to the on-chip ram is generated [setting conditions] when all of the following conditions are satisfied and 1 is written to this bit ? fkey is written to h'a5 ? during execution in the on-chip ram ? not in ram emulation mode (rams in ramcr = 0)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 814 of 1080 rej09b0230-0300 (2) flash program code select register (fpcs) fpcs selects the on-chip programming program to be downloaded. bit: initial value: r/w: 7654321 0 00000000 rrrrrrrr/w ------- ppvs bit bit name initial value r/w description 7 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 ppvs 0 r/w program pulse single selects the programming program. 0: on-chip programming program is not selected [clearing condition] when transfer is completed 1: on-chip programming program is selected (3) flash erase code select register (fecs) fecs selects download of the on-chip erasing program. bit: initial value: r/w: 7654321 0 00000000 rrrrrrrr/w -------epvb bit bit name initial value r/w description 7 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 815 of 1080 rej09b0230-0300 bit bit name initial value r/w description 0 epvb 0 r/w erase pulse verify block selects the erasing program. 0: on-chip erasing program is not selected [clearing condition] when transfer is completed 1: on-chip erasing program is selected (4) flash key code register (fkey) fkey is a register for software protection that enables download of the on-chip program and programming/erasing of flash memory. before setting the sco bit to 1 in order to download the on-chip program or executing the downloaded programming/erasing program, these processings cannot be executed if the key code is not written. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w k[7:0] bit bit name initial value r/w description 7 to 0 k[7:0] all 0 r/w key code only when h'a5 is written, writing to the sco bit is valid. when a value other than h'a5 is written to fkey, 1 cannot be written to the sco bit. therefore downloading to the on-chip ram cannot be executed. only when h'5a is written, programming/erasing of flash memory can be executed. even if the on-chip programming/erasing program is executed, flash memory cannot be programmed or erased when a value other than h'5a is written to fkey. h'a5: writing to the sco bit is enabled (the sco bit cannot be set by a value other than h'a5.) h'5a: programming/erasing is enabled (a value other than h'5a enables software protection state.) h'00: initial value
section 20 flash memory rev. 3.00 oct. 06, 2008 page 816 of 1080 rej09b0230-0300 (5) flash mat select register (fmats) fmats specifies whether the user mat or user boot mat is selected. bit: initial value: r/w: 7654321 0 0/1 0 0/1 0 0/1 0 0/1 0 r/w r/w r/w r/w r/w r/w r/w r/w ms7 ms6 ms5 ms4 ms3 ms2 ms1 ms0 bit bit name initial value r/w description 7 6 5 4 3 2 1 0 ms7 ms6 ms5 ms4 ms3 ms2 ms1 ms0 0/1 0 0/1 0 0/1 0 0/1 0 r/w r/w r/w r/w r/w r/w r/w r/w mat select these bits are in user-mat selected state when a value other than h'aa is written and in user-boot-mat selected state when h'aa is written. the mat is switched by writing a value in fmats with the on-chip ram instruction. when the mat is switched, follow section 20.8.1, switching between user mat and user boot mat. (the user boot mat cannot be programmed in user program mode if user boot mat is selected by fmats. the user boot mat must be programmed in boot mode or in programmer mode.) h'aa: the user boot mat is selected (in user-mat selected state when the value of these bits are other than h'aa) initial value when these bits are initiated in user boot mode. h'00: initial value when these bits are initiated in a mode except for user boot mode (in user-mat selected state) [programmable condition] these bits are in the execution state in the on-chip ram.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 817 of 1080 rej09b0230-0300 (6) flash transfer destination address register (ftdar) ftdar specifies the on-chip ram address to which the on-chip program is downloaded. make settings for ftdar before writing 1 to the sco bit in fccs. the initial value is h'00 which points to the start address (h'ffff9000) in on-chip ram. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r/w r/w r/w r/w r/w r/w tder tda[6:0] bit bit name initial value r/w description 7 tder 0 r/w transfer destination address setting error this bit is set to 1 when there is an error in the download start address set by bits 6 to 0 (tda6 to tda0). whether the address setting is erroneous or not is tested by checking whether the setting of tda6 to tda0 is in the range of h'00 to h'04 after setting the sco bit in fccs to 1 and performing download. before setting the sco bit to 1 be sure to set the ftdar value between h'00 to h'04 as well as clearing this bit to 0. 0: setting of tda6 to tda0 is normal 1: setting of tder and tda6 to tda0 is h'05 to h'ff and download has been aborted 6 to 0 tda[6:0] all 0 r/w transfer destination address these bits specify the download start address. a value from h'00 to h'04 can be set to specify the download start address in on-chip ram in 2-kbyte units. a value from h'05 to h'7f cannot be set. if such a value is set, the tder bit (bit 7) in this register is set to 1 to prevent download from being executed. h'00: download start address is set to h'ffff9000 h'01: download start address is set to h'ffff9800 h'02: download start address is set to h'ffffa000 h'03: download start address is set to h'ffffa800 h'04: download start address is set to h'ffffb000 h'05 to h'7f: setting prohibited. if this value is set, the tder bit (bit 7) is set to 1 to abort the download processing.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 818 of 1080 rej09b0230-0300 20.4.3 programming/erasing in terface parameters the programming/erasing interface parameters speci fy the operating frequency, user branch destination address, storage place for program da ta, programming destination address, and erase block and exchanges the processing result for the downloaded on-chip program. this parameter uses the general registers of the cpu (r4, r5, a nd r0) or the on-chip ram area. the initial value is undefined. at download all cpu registers are stored, and at initialization or when the on-chip program is executed, cpu registers except for r0 are stored . the return value of the processing result is written in r0. since the stack area is used for storing the registers or as a work area, the stack area must be saved at the processing start. (the maximum size of a stack area to be used is 128 bytes.) the programming/erasing interface parameters are used in the following four items. 1. download control 2. initialization before programming or erasing 3. programming 4. erasing these items use different parameters. the correspondence table is shown in table 20.6. the processing results of initialization, programming, and erasing are returned, but the bit contents have different meanings according to the processing program. see the description of fpfr for each processing.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 819 of 1080 rej09b0230-0300 table 20.6 usable parameters and target modes name of parameter abbrevia- tion down- load initiali- zation pro- gram- ming erasure r/w initial value allocation download pass/fail result dpfr ? ? ? r/w undefined on-chip ram * flash pass/fail result fpfr ? r/w undefined r0 of cpu flash programming/ erasing frequency control fpefeq ? ? ? r/w undefined r4 of cpu flash user branch address set fubra ? ? ? r/w undefined r5 of cpu flash multipurpose address area fmpar ? ? ? r/w undefined r5 of cpu flash multipurpose data destination area fmpdr ? ? ? r/w undefined r4 of cpu flash erase block select febs ? ? ? r/w undefined r4 of cpu note: * one byte of start address of download destination specified by ftdar
section 20 flash memory rev. 3.00 oct. 06, 2008 page 820 of 1080 rej09b0230-0300 (1) download control the on-chip program is automatically downloaded by setting the sco bit to 1. the on-chip ram area to be downloaded is the 3-kbyte area starting from the start address specified by ftdar. for the address map of the on-chip ram, see figure 20.10. the download control is set by using the prog ramming/erasing interface registers. the return value is given by the dpfr parameter. ? download pass/fail result parameter (dpfr: one byte of start address of on-chip ram specified by ftdar) this parameter indicates the return value of the download result. the value of this parameter can be used to determine if downloading is executed or not. since the confirmation whether the sco bit is set to 1 is difficult, the certain determination must be performed by setting one byte of the start address of the on-chip ram area sp ecified by ftdar to a value other than the return value of download (for example, h'ff) before the download start (before setting the sco bit to 1). for the checking method of download results, see section 20.5.2 (2), programming procedure in user program mode. bit: initial value: r/w: 7654321 0 -------- r/w r/w r/w r/w r/w r/w r/w r/w -----ssfksf bit bit name initial value r/w description 7 to 3 ? undefined r/w unused return 0. 2 ss undefined r/w source select error detect the on-chip program which can be downloaded can be specified as only one type. when more than two types of the program are selected, the program is not selected, or the program is selected without mapping, an error occurs. 0: download program can be selected normally 1: download error occurs (multi-selection or program which is not mapped is selected)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 821 of 1080 rej09b0230-0300 bit bit name initial value r/w description 1 fk undefined r/w flash key register error detect returns the check result whether the value of fkey is set to h'a5. 0: fkey setting is normal (fkey = h'a5) 1: fkey setting is abnormal (fkey = value other than h'a5) 0 sf undefined r/w success/fail returns the result whether download has ended normally or not. 0: downloading on-chip program has ended normally (no error) 1: downloading on-chip program has ended abnormally (error occurs) (2) programming/erasing initialization the on-chip programming/erasing program to be downloaded includes the initialization program. the specified period pulse must be applied when programming or erasing. the specified pulse width is made by the method in which wait loop is configured by the cpu instruction. the operating frequency of the cpu must be set. since the user branch function is supported, the user branch destination address must be set. the initial program is set as a parameter of the programming/erasing program which has downloaded these settings. ? flash programming/erasing frequency parameter (fpefeq: general register r4 of cpu) this parameter sets the operating frequency of the cpu. for the range of the operating frequency of this lsi, see section 25.3.1, clock timing. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- f15 f14 f13 f12 f11 f10 f9 f8 f7 f6 f5 f4 f3 f2 f1 f0
section 20 flash memory rev. 3.00 oct. 06, 2008 page 822 of 1080 rej09b0230-0300 bit bit name initial value r/w description 31 to 16 ? undefined r/w unused return 0. 15 to 0 f15 to f0 undefined r/w frequency set set the operating frequency of the cpu. the setting value must be calculated as the following methods. 1. the operating frequency which is shown in mhz units must be rounded in a number to three decimal places and be shown in a number of two decimal places. 2. the centuplicated value is converted to the binary digit and is written to the fpefeq parameter (general register r4). for example, when the operating frequency of the cpu is 28.882 mhz, the value is as follows. ? the number to three decimal places of 28.882 is rounded and the value is thus 28.88. ? the formula that 28.88 100 = 2888 is converted to the binary digit and b'0000, b'1011, b'0100, b'1000 (h'0b48) is set to r4. ? flash user branch address setting parameter (fubra: general register r5 of cpu) this parameter sets the user branch destination address. the user program which has been set can be executed in specified processi ng units when programming and erasing. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ua31 ua30 ua29 ua28 ua27 ua26 ua25 ua24 ua23 ua22 ua21 ua20 ua19 ua18 ua17 ua16 ua15 ua14 ua13 ua12 ua11 ua10 ua9 ua8 ua7 ua6 ua5 ua4 ua3 ua2 ua1 ua0
section 20 flash memory rev. 3.00 oct. 06, 2008 page 823 of 1080 rej09b0230-0300 bit bit name initial value r/w description 31 to 0 ua31 to ua0 undefined r/w user branch destination address when the user branch is not required, address 0 (h'00000000) must be set. the user branch destination must be an area other than the flash memory, an area other than the ram area in which on-chip program has been transferred, or the external bus space. note that the cpu must not branch to an area without the execution code and get out of control. the on-chip program download area and stack area must not be overwritten. if cpu runaway occurs or the download area or stack area is overwritten, the value of flash memory cannot be guaranteed. the download of the on-chip program, initialization, initiation of the programming/erasing program must not be executed in the processing of the user branch destination. programming or erasing cannot be guaranteed when returning from the user branch destination. the program data which has already been prepared must not be programmed. store general registers r8 to r15. general registers r0 to r7 are available without storing them. moreover, the programming/erasing interface registers must not be written to or ram emulation mode must not be entered in the processing of the user branch destination. after the processing of the user branch has ended, the programming/erasing program must be returned to by using the rts instruction. for the execution intervals of the user branch processing, see note 2 (user branch processing intervals) in section 20.8.3, other notes.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 824 of 1080 rej09b0230-0300 ? flash pass/fail result parameter (fpfr: general register r0 of cpu) this parameter indicates the return value of the initialization result. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- -------------brfqsf bit bit name initial value r/w description 31 to 3 ? undefined r/w unused return 0. 2 br undefined r/w user branch error detect returns the check result whether the specified user branch destination address is in the area other than the storage area of the programming/erasing program which has been downloaded. 0: user branch address setting is normal 1: user branch address setting is abnormal 1 fq undefined r/w frequency error detect returns the check result whether the specified operating frequency of the cpu is in the range of the supported operating frequency. 0: setting of operating frequency is normal 1: setting of operating frequency is abnormal 0 sf undefined r/w success/fail indicates whether initialization is completed normally. 0: initialization has ended normally (no error) 1: initialization has ended abnormally (error occurs)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 825 of 1080 rej09b0230-0300 (3) programming execution when flash memory is programmed, the progra mming destination address and programming data on the user mat must be passed to the programming program in which the program data is downloaded. 1. the start address of the programming destination on the user mat is set in general register r5 of the cpu. this parameter is called fmpar (flash multipurpose address area parameter). since the program data is always in 128-byte units, the lower eight bits (moa7 to moa0) must be h'00 or h'80 as the boundary of the programming start address on the user mat. 2. the program data for the user mat must be prepared in the consecutive area. the program data must be in the consecutive space which can be accessed by using the mov.b instruction of the cpu and is not the flash memory space. when data to be programmed does not satisfy 128 bytes, the 128-byte program data must be prepared by embedding the dummy code (h'ff). the start address of the area in which the prepared program data is stored must be set in general register r4. this parameter is called fmpdr (flash multipurpose data destination area parameter). for details on the programming procedure, see section 20.5.2, user program mode. ? flash multipurpose address area parameter (fmpar: general register r5 of cpu) this parameter indicates the start address of the programming destination on the user mat. when an address in an area other than the fl ash memory space is set, an error occurs. the start address of the programming destination must be at the 128-byte boundary. if this boundary condition is not satisfied, an error o ccurs. the error occurrence is indicated by the wa bit (bit 1) in fpfr. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w moa31 moa30 moa29 moa28 moa27 moa26 moa25 moa24 moa23 moa22 moa21 moa20 moa19 moa18 moa17 moa16 moa15 moa14 moa13 moa12 moa11 moa10 moa9 moa8 moa7 moa6 moa5 moa4 moa3 moa2 moa1 moa0
section 20 flash memory rev. 3.00 oct. 06, 2008 page 826 of 1080 rej09b0230-0300 bit bit name initial value r/w description 31 to 0 moa31 to moa0 undefined r/w moa31 to moa0 store the start address of the programming destination on the user mat. the consecutive 128-byte programming is executed starting from the specified start address of the user mat. the moa6 to moa0 bits are always 0 because the start address of the programming destination is at the 128-byte boundary. ? flash multipurpose data destination area parameter (fmpdr: general register r4 of cpu) this parameter indicates the start address in th e area which stores the data to be programmed in the user mat. when the storage destination of the program data is in flash memory, an error occurs. the error occurrence is indicated by the wd bit (bit 2) in fpfr. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w mod31 mod30 mod29 mod28 mod27 mod26 mod25 mod24 mod23 mod22 mod21 mod20 mod19 mod18 mod17 mod16 mod15 mod14 mod13 mod12 mod11 mod10 mod9 mod8 mod7 mod6 mod5 mod4 mod3 mod2 mod1 mod0 bit bit name initial value r/w description 31 to 0 mod31 to mod0 undefined r/w mod31 to mod0 store the start address of the area which stores the program data for the user mat. the consecutive 128- byte data is programmed to the user mat starting from the specified start address.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 827 of 1080 rej09b0230-0300 ? flash pass/fail result parameter (fpfr: general register r0 of cpu) this parameter indicates the return value of the program processing result. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- ---------mdeefk-wdwasf bit bit name initial value r/w description 31 to 7 ? undefined r/w unused return 0. 6 md undefined r/w programming mode related setting error detect returns the check result of whether the signal input to the fwe pin is high and whether the error protection state is not entered. when a low-level signal is input to the fwe pin or the error protection state is entered, 1 is written to this bit. the input level to the fwe pin and the error protection state can be confirmed with the fwe bit (bit 7) and the fler bit (bit 4) in fccs, respectively. for conditions to enter the error protection state, see section 20.6.3, error protection. 0: fwe and fler settings are normal (fwe = 1, fler = 0) 1: fwe = 0 or fler = 1, and programming cannot be performed
section 20 flash memory rev. 3.00 oct. 06, 2008 page 828 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 ee undefined r/w programming execution error detect 1 is returned to this bit when the specified data could not be written because the user mat was not erased or when flash-memory related register settings are partially changed on returning from the user branch processing. if this bit is set to 1, there is a high possibility that the user mat is partially rewritten. in this case, after removing the error factor, erase the user mat. if fmats is set to h'aa and the user boot mat is selected, an error occurs when programming is performed. in this case, both the user mat and user boot mat are not rewritten. programming of the user boot mat must be executed in boot mode or programmer mode. 0: programming has ended normally 1: programming has ended abnormally (programming result is not guaranteed) 4 fk undefined r/w flash key register error detect returns the check result of the value of fkey before the start of the programming processing. 0: fkey setting is normal (fkey = h'5a) 1: fkey setting is error (fkey = value other than h'5a) 3 ? undefined r/w unused return 0. 2 wd undefined r/w write data address error detect when an address in the flash memory area is specified as the start address of the storage destination of the program data, an error occurs. 0: setting of write data address is normal 1: setting of write data address is abnormal
section 20 flash memory rev. 3.00 oct. 06, 2008 page 829 of 1080 rej09b0230-0300 bit bit name initial value r/w description 1 wa undefined r/w write address error detect when the following items are specified as the start address of the programming destination, an error occurs. ? the programming destination address is an area other than flash memory ? the specified address is not at the 128-byte boundary (a6 to a0 are not 0) 0: setting of programming destination address is normal 1: setting of programming destination address is abnormal 0 sf undefined r/w success/fail indicates whether the program processing has ended normally or not. 0: programming has ended normally (no error) 1: programming has ended abnormally (error occurs)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 830 of 1080 rej09b0230-0300 (4) erasure execution when flash memory is erased, the erase-block number on the user mat must be passed to the erasing program which is downloaded. this is set to the febs parameter (general register r4). one block is specified from the block number 0 to 15. for details on the erasing procedure, see section 20.5.2, user program mode. ? flash erase block select parameter (febs: general register r4 of cpu) this parameter specifies the erase-block number. several block numbers cannot be specified. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- - - - - - - - - ebs[7:0] bit bit name initial value r/w description 31 to 8 ? undefined r/w unused return 0. 7 to 0 ebs[7:0] undefined r/w ? 512-kbyte flash memory set the erase-block number in the range from 0 to 15. 0 corresponds to the eb0 block and 15 corresponds to the eb15 block. an error occurs when a number other than 0 to 15 (h'00 to h'0f) is set. ? 384-kbyte flash memory set the erase-block number in the range from 0 to 13. 0 corresponds to the eb0 block and 13 corresponds to the eb13 block. an error occurs when a number other than 0 to 13 (h'00 to h'0d) is set. ? 256-kbyte flash memory set the erase-block number in the range from 0 to 11. 0 corresponds to the eb0 block and 11 corresponds to the eb11 block. an error occurs when a number other than 0 to 11 (h'00 to h'0b) is set.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 831 of 1080 rej09b0230-0300 ? flash pass/fail result parameter (fpfr: general register r0 of cpu) this parameter returns the value of the erasing processing result. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ---------------- ---------mdeefkeb--sf bit bit name initial value r/w description 31 to 7 ? undefined r/w unused return 0. 6 md undefined r/w erasure mode related setting error detect returns the check result of whether the signal input to the fwe pin is high and whether the error protection state is not entered. when a low-level signal is input to the fwe pin or the error protection state is entered, 1 is written to this bit. the input level to the fwe pin and the error protection state can be confirmed with the fwe bit (bit 7) and the fler bit (bit 4) in fccs, respectively. for conditions to enter the error protection state, see section 20.6.3, error protection. 0: fwe and fler settings are normal (fwe = 1, fler = 0) 1: fwe = 0 or fler = 1, and erasure cannot be performed
section 20 flash memory rev. 3.00 oct. 06, 2008 page 832 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5 ee undefined r/w erasure execution error detect 1 is returned to this bit when the user mat could not be erased or when flash-memory related register settings are partially changed on returning from the user branch processing. if this bit is set to 1, there is a high possibility that the user mat is partially erased. in this case, after removing the error factor, erase the user mat. if fmats is set to h'aa and the user boot mat is selected, an error occurs when erasure is performed. in this case, both the user mat and user boot mat are not erased. erasure of the user boot mat must be executed in boot mode or programmer mode. 0: erasure has ended normally 1: erasure has ended abnormally (erasure result is not guaranteed) 4 fk undefined r/w flash key register error detect returns the check result of fkey value before start of the erasing processing. 0: fkey setting is normal (fkey = h'5a) 1: fkey setting is error (fkey = value other than h'5a) 3 eb undefined r/w erase block select error detect returns the check result whether the specified erase- block number is in the block range of the user mat. 0: setting of erase-block number is normal 1: setting of erase-block number is abnormal 2, 1 ? undefined r/w unused return 0. 0 sf undefined r/w success/fail indicates whether the erasing processing has ended normally or not. 0: erasure has ended normally (no error) 1: erasure has ended abnormally (error occurs)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 833 of 1080 rej09b0230-0300 20.4.4 ram emulation register (ramer) when the realtime programming of the user mat is emulated, ramer sets the area of the user mat which is overlapped with a part of the on-chip ram. the ram emulation must be executed in user mode or in user program mode. for the division method of the user-mat area, see table 20.7. in order to operate the emulation function certainly, the target mat of the ram emulation must not be accessed i mmediately after ramer is programmed. if it is accessed, the normal access is not guaranteed. bit: initial value: r/w: 151413121110987654321 0 0000000000000000 rrrrrrrrrrrrr/wr/wr/wr/w - - - - - - - - - - - - rams ram[2:0] bit bit name initial value r/w description 15 to 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 rams 0 r/w ram select sets whether the user mat is emulated or not. when rams = 1, all blocks of the user mat are in the programming/erasing protection state. 0: emulation is not selected programming/erasing protection of all user-mat blocks is invalid 1: emulation is selected programming/erasing protection of all user-mat blocks is valid 2 to 0 ram[2:0] 000 r/w user mat area select these bits are used with bit 3 to select the user-mat area to be overlapped with the on-chip ram. (see table 20.7.)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 834 of 1080 rej09b0230-0300 table 20.7 overlapping of ram area and user mat area ram area block name rams ram2 ram1 ram0 h'ffffa000 to h'ffffafff ram area (4 kbytes) 0 x x x h'00000000 to h'00000fff eb0 (4 kbytes) 1 0 0 0 h'00001000 to h'00001fff eb1 (4 kbytes) 1 0 0 1 h'00002000 to h'00002fff eb2 (4 kbytes) 1 0 1 0 h'00003000 to h'00003fff eb3 (4 kbytes) 1 0 1 1 h'00004000 to h'00004fff eb4 (4 kbytes) 1 1 0 0 h'00005000 to h'00005fff eb5 (4 kbytes) 1 1 0 1 h'00006000 to h'00006fff eb6 (4 kbytes) 1 1 1 0 h'00007000 to h'00007fff eb7 (4 kbytes) 1 1 1 1 note: x: don't care.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 835 of 1080 rej09b0230-0300 20.5 on-board programming mode when the pin is set in on-board programming mode and the reset start is executed, the on-board programming state that can program/erase the on-chip flash memory is entered. on-board programming mode has three operating modes: us er program mode, user boot mode, and boot mode. for details on the pin setting for entering each mode, see table 20.1. for details on the state transition of each mode for flash memory, see figure 20.2. 20.5.1 boot mode boot mode executes programming/erasing user mat and user boot mat by means of the control command and program data transmitted from the host using the on-chip sci. the tool for transmitting the control command and program data must be prepared in the host. the sci communication mode is set to asynchronous mode. when reset start is executed after this lsi's pin is set in boot mode, the boot program in the micr ocomputer is initiated. after the sci bit rate is automatically adjusted, the communication with the host is executed by means of the control command method. the system configuration diagram in boot mode is shown in figure 20.6. for details on the pin setting in boot mode, see table 20.1. interrupts are ignored in boot mode, so do not generate them. note that the aud cannot be used during boot mode operation. host rxd1 t xd1 control command, analysis execution software (on-chip) flash memory on-chip ram on-chip sci1 this lsi boot pro g rammin g tool and pro g ram data control command, pro g ram data reply response figure 20.6 system configuration in boot mode
section 20 flash memory rev. 3.00 oct. 06, 2008 page 836 of 1080 rej09b0230-0300 (1) sci interface setting by host when boot mode is initiated, this lsi measures the low period of asynchronous sci- communication data (h'00), which is transmitted consecutively by the host. the sci transmit/receive format is set to 8-bit data, 1 stop b it, and no parity. this lsi calculates the bit rate of transmission by the host by means of the measured low period and transmits the bit adjustment end sign (1 byte of h'00) to the host. the host must confirm that this bit adjustment end sign (h'00) has been received normally and transmits 1 byte of h'55 to this lsi. when reception is not executed normally, boot mode is initiated again (r eset) and the operation described above must be executed. the bit rate between th e host and this lsi is not matche d because of the bit rate of transmission by the host and system clock frequency of this lsi. to operate the sci normally, the transfer bit rate of the host must be set to 9,600 bps or 19,200 bps. the system clock frequency which can automatically adjust the transfer bit rate of the host and the bit rate of this lsi is shown in table 20.8. boot mode must be initiated within the ranges of these system clock frequencies. note that the internal clock division ratio of 1/3 is not supported in boot mode. d0 d1 d2 d3 d4 d5 d6 d7 start bit stop bit measure low period (9 bits) (data is h'00) hi g h period of at least 1 bit figure 20.7 automatic adjustment operation of sci bit rate table 20.8 peripheral clock (p ) frequency that can automatically adjust bit rate of this lsi host bit rate peripheral clock (p ) frequency which can automatically adjust lsi's bit rate 9,600 bps 10 to 40 mhz (t opr = ? 40 to + 85 c) 10 to 32 mhz (t opr = ? 40 to + 125 c) 19,200 bps 10 to 40 mhz (t opr = ? 40 to + 85 c) 10 to 32 mhz (t opr = ? 40 to + 125 c) note: the internal clock division ratio of 1/3 is not supported in boot mode.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 837 of 1080 rej09b0230-0300 (2) state transition diagram figure 20.8 gives an overview of the state transitions after the chip has been started up in boot mode. for details on boot mode, see section 20.9.1, specifications of the standard serial communications interface in boot mode. 1. bit-rate matching after the chip has been started up in boot mode, bit-rate matching between the sci and the host proceeds. 2. waiting for inquiry and selection commands the chip sends the requested information to the host in response to inquiries regarding the size and configuration of the user mat, start addresses of the mats, information on supported devices, etc. 3. automatic erasure of the entire user mat and user boot mat after all necessary inquiries and selections have been made a nd the command for transition to the programming/erasure state is sent by the host, the entire user mat and user boot mat are automatically erased. 4. waiting for programming/erasure command ? on receiving the programming selection command, the chip waits for data to be programmed. to program data, the host transmits the programming command code followed by the address where programming should start and the data to be programmed. this is repeated as required while the chip is in the programming-selected state. to terminate programming, h'ffffffff should be transmitted as the first address of the area for programming. this makes the chip return to the programming/erasure command waiting state from the programming data waiting state. ? on receiving the erasure select command, the ch ip waits for the block number of a block to be erased. to erase a block, the host transm its the erasure command code followed by the number of the block to be erased. this is rep eated as required while the chip is in the erasure-selected state. to terminate eras ure, h'ff should be transmitted as the block number. this makes the chip return to the programming/erasure command waiting state from the erasure block number waiting state. erasure should only be executed when a specific block is to be reprogrammed without executing a reset-start of the chip after the flash memory has been programmed in boot m ode. if all desired programming is done in a single operation, such erasure processing is not necessary because all blocks are erased before the chip enters the programming/erasure/other command waiting state. ? in addition to the programming and erasure commands, commands for sum checking and blank checking (checking for erasure) of the user mat and user boot mat, reading data from the user mat/user boot mat, and acquiring current state information are provided.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 838 of 1080 rej09b0230-0300 note that the command for reading from the user mat/user boot mat can only read data that has been programmed after automatic erasure of the entire user mat and user boot mat. start in boot mode (reset in boot mode) erasure of entire user mat and user boot mat bit rate matchin g wait for inquiry/selection command wait for pro g rammin g /erasure command execute processin g in response to inquiry/ selection command execute processin g in response to read/ check command wait for erasure block number wait for pro g rammin g data transmission of pro g rammin g data by the host erasure block specification reception of inquiry/selection command response to inquiry/selection command reception of read/check command response to command pro g rammin g complete reception of pro g rammin g select command erasure complete reception of erasure select command 1. 2. 3. 4. (bit rate matchin g ) reception of h'00, ?, h'00 reception of h'55 figure 20.8 state transitions in boot mode
section 20 flash memory rev. 3.00 oct. 06, 2008 page 839 of 1080 rej09b0230-0300 20.5.2 user program mode the user mat can be programmed/erased in user program mode (the user boot mat cannot be programmed/erased in this mode). programming/erasing is executed by downloading the program in the microcomputer. an overview of the flow is shown in figure 20.9. high voltage is applied to internal flash memory during the programming/erasing processing. therefore, transition to reset or hardware standby mode must not be executed. doing so may cause damage or destroy flash memory. if reset is executed accidentally, the reset signal must be released after the reset input period, which is longer than the normal 100 s. for details on the programming procedure, see the description in section 20.5.2 (2), programming procedure in user program mode. for details on the erasing procedure, see the description in section 20.5.2 (3), erasing procedure in user program mode. for the overview of a processing that repeats erasing and programming by downloading the programming program and the erasing program in separate on-chip rom areas using ftdar, see the description in section 20.5.2 (4), erasing and programming procedure in user program mode. when pro g rammin g , pro g ram data is prepared fwe=1 ? pro g rammin g /erasin g procedure pro g ram is transferred to the on-chip ram and executed yes no pro g rammin g /erasin g start pro g rammin g /erasin g end 1. ram emulation mode must be canceled in advance. download cannot be executed in emulation mode. 2. when the pro g ram data is made by means of emulation, the download destination must be chan g ed by ftdar. 3. inputtin g hi g h level to the fwe pin sets the fwe bit to 1. 4. pro g rammin g /erasin g is executed only in the on-chip ram. however, if the pro g ram data is in a consecutive area and can be accessed by the mov.b instruction of the cpu like sram/rom, the pro g ram data can be in an external space. 5. after pro g rammin g /erasin g is finished, low level must be input to the fwe pin for protection. figure 20.9 programming/erasing overview flow
section 20 flash memory rev. 3.00 oct. 06, 2008 page 840 of 1080 rej09b0230-0300 (1) on-chip ram address map when programming/erasing is executed parts of the procedure program that are made by the user, like download request, programming/erasing procedure, and determination of the result, must be executed in the on-chip ram. all of the on-chip program that is to be downloaded is in on-chip ram. note that on-chip ram must be controlled so that these parts do not overlap. figure 20.10 shows the program area to be downloaded. system use area (15 bytes) ramtop h'ffff8000 (16 kbytes) h'ffff9000 (12 kbytes) ftdar settin g pro g rammin g / erasin g entry dpfr (return value: 1 byte) area that can be used by user ram emulation area ftdar settin g +16 < on-chip ram > address initialization process entry ftdar settin g +32 ftdar settin g +3072 initialization + pro g rammin g pro g ram or initialization + erasin g pro g ram area that can be used by user h'ffffa000 h'ffffafff area that can be used by user ramend (h'ffffbfff) area to be downloaded (size: 3 kbytes) unusable area in pro g rammin g /erasin g processin g period figure 20.10 ram map after download
section 20 flash memory rev. 3.00 oct. 06, 2008 page 841 of 1080 rej09b0230-0300 (2) programming procedure in user program mode the procedures for download, initialization, and programming are shown in figure 20.11. select on-chip pro g ram to be downloaded and set download destination by ftdar set fkey to h'a5 after clearin g vbr, set sco to 1 and execute download dpfr=0? yes no download error processin g set the fpefeq and fubra parameters initialization jsr ftdar settin g +32 yes end pro g rammin g procedure pro g ram fpfr=0? no initialization error processin g clear fkey to 0 set parameter to r4 and r5 (fmpar and fmpdr) pro g rammin g jsr ftdar settin g +16 yes fpfr=0? no clear fkey and pro g rammin g error processin g yes required data pro g rammin g is completed? no set fkey to h'5a clear fkey to 0 (2.1) (2.2) (2.4) (2.5) (2.6) (2.7) (2.8) (2.9) (2.10) (2.11) (2.12) (2.13) (2.14) 1 1 (2.3) download initialization pro g rammin g start pro g rammin g procedure pro g ram figure 20.11 programming procedure the details of the programming procedure are described below. the procedure program must be executed in an area other than the flash memory to be programmed. especially the part where the sco bit in fccs is set to 1 for downloading must be executed in the on-chip ram. the frequency division ratios of an internal clock (i ), a bus clock (b ), and a peripheral clock (p ) should be specified as 1/4 (initial value) by the frequency control register (frqcr). after the programming/erasing program has been downloaded and the sco bit is cleared to 0, the setting of the frequency control register (frqcr) can be changed to the desired value.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 842 of 1080 rej09b0230-0300 the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 20.9. 2, areas for storage of the procedural program and data for programming. the following description assumes the area to be programmed on the user mat is erased and program data is prepared in the consecutive area. when erasing has not been executed, carry out erasing before writing. 128-byte programming is performed in one program processing. when more than 128-byte programming is performed, programming destina tion address/program data parameter is updated in 128-byte units and programming is repeated. when less than 128-byte programming is performed, data must total 128 bytes by adding the invalid data. if the invalid data to be added is h'ff, the program processing period can be shortened. (2.1) select the on-chip program to be downloaded when the ppvs bit of fpcs is set to 1, the programming program is selected. several programming/erasing programs cannot be se lected at one time. if several programs are set, download is not performed and a download error is returned to the source select error detect (ss) bit in the dpfr parameter. specify the start address of the download destination by ftdar. (2.2) write h'a5 in fkey if h'a5 is not written to fkey for protection, 1 cannot be written to the sco bit for a download request. (2.3) vbr is set to 0 and 1 is written to the sco bit of fccs, and then download is executed. vbr must always be set to h'84000000 before setting the sco bit to 1. to write 1 to the sco bit, the following conditions must be satisfied. 1. ram emulation mode is canceled. 2. h'a5 is written to fkey. 3. the sco bit writing is executed in the on-chip ram. when the sco bit is set to 1, download is started automatically. when execution returns to the user procedure program, the sco bit is cleared to 0. therefore, the sco bit cannot be confirmed to be 1 in the user procedure program. the download result can be confirmed only by the retu rn value of the dpfr parameter. before the sco bit is set to 1, incorrect determination must be prevented by setting the dpfr parameter, that is one byte of the start address of the on-chip ram area specified by ftdar, to a value other than the return value (h'ff). when download is executed, particular interrupt processing, which is accompanied by the bank switch as described below, is performed as an internal microcomputer processing, so vbr need to
section 20 flash memory rev. 3.00 oct. 06, 2008 page 843 of 1080 rej09b0230-0300 be set to h'84000000. four nop instructions are executed immediately after the instructions that set the sco bit to 1. 1. the user mat space is switched to the on-chip program storage area. 2. after the selection condition of the download program and the address set in ftdar are checked, the transfer processi ng is executed starting to the on-chip ram address specified by ftdar. 3. the sco bits in fccs, fpcs , and fecs are cleared to 0. 4. the return value is set to the dpfr parameter. 5. after the on-chip program storage area is returned to the us er mat space, execution returns to the user procedure program. after download is completed and the user proce dure program is running, the vbr setting can be changed. the notes on download are as follows. in the download processing, the values of th e general registers of the cpu are retained. during the download processing, interrupts must not be generated. for details on the relationship between download and interrupts, see section 20.8.2, interrupts during programming/erasing. since a stack area of maximum 128 bytes is used, an area of at least 128 bytes must be saved before setting the sco bit to 1. if flash memory is accessed by the dtc during downloading, operation cannot be guaranteed. therefore, access by the dtc must not be executed. (2.4) fkey is cleared to h'00 for protection. (2.5) the value of the dpfr parameter must be checked to confirm the download result. a recommended procedure for confirming the download result is shown below. 1. check the value of the dpfr parameter ( one byte of start address of the download destination specified by ftdar). if the value is h'00, download has been performed normally. if the value is not h'00, the source that caused download to fail can be investigated by the description below. 2. if the value of the dpfr parameter is the same as before downloading (e.g. h'ff), the address setting of the download destination in ftdar may be abnormal. in this case, confirm the setting of the tder bit (bit 7) in ftdar. 3. if the value of the dpfr parameter is different from before downloading, check the ss bit (bit 2) and the fk bit (bit 1) in the dpfr parameter to ensure that the download program selection and fkey register setting were normal, respectively.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 844 of 1080 rej09b0230-0300 (2.6) the operating frequency is set to the fpefe q parameter and the user branch destination is set to the fubra parameter for initialization. 1. the current frequency of the cpu clock is set to the fpefeq parameter (general register r4). for the settable range of the fpefeq parameter, see section 25.3.1, clock timing. when the frequency is set out of this range, an error is returned to the fpfr parameter of the initialization program and initialization is not performed. for details on the frequency setting, see the description of flash programming/erasing frequency parameter (fpefeq: general register r4 of cpu) in section 20.4.3 (2), programming/erasing initialization. 2. the start address in the user branch destination is set to the fubra parameter (general register r5). when the user branch processing is not required, 0 must be set to fubra. when the user branch is execute d, the branch destination is executed in flash memory other than the one that is to be programmed. the ar ea of the on-chip program that is downloaded cannot be set. the program processing must be returned from the user branch processing by the rts instruction. see the description of flash user branch address setting parameter (fubra: general register r5 of cpu) in section 20.4.3 (2), programming/erasing initialization. (2.7) initialization when a programming program is downloaded, the initialization program is also downloaded to on-chip ram. there is an entry point of the initialization program in the area from (download start address set by ftdar) + 32 bytes. the subroutine is called and initialization is executed by using the following steps. mov.l #dltop+32,r1 ; set entry address to r1 jsr @r1 ; call initialization routine nop 1. the general registers other than r0 are saved in the initialization program. 2. r0 is a return value of the fpfr parameter. 3. since the stack area is used in the initialization program, a stack area of maximum 128 bytes must be reserved in ram. 4. interrupts can be accepted during the execution of the initialization program. however, the program storage area and stack area in on-chip ram and register values must not be destroyed. (2.8) the return value of the initialization progr am, fpfr (general register r0) is checked. (2.9) fkey must be set to h'5a and the user mat must be prepared for programming. (2.10) the parameter which is required for programming is set.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 845 of 1080 rej09b0230-0300 the start address of the programming destination of the user mat (fmpar) is set to general register r5. the start address of the program data storage area (fmpdr) is set to general register r4. 1. fmpar setting fmpar specifies the programming destination st art address. when an address other than one in the user mat area is specified, even if the programming program is executed, programming is not executed and an error is returned to the return value parameter fpfr. since the unit is 128 bytes, the lower eight bits (moa7 to moa0) must be in the 128-byte boundary of h'00 or h'80. 2. fmpdr setting if the storage destination of the program data is flash memory, even when the program execution routine is executed, programming is no t executed and an error is returned to the fpfr parameter. in this case, the program data must be transferred to on-chip ram and then programming must be executed. (2.11) programming there is an entry point of the programming program in the area from (download start address set by ftdar) + 16 bytes of on-chip ram. the subroutine is called and programming is executed by using the following steps. mov.l #dltop+16,r1 ; set entry address to r1 jsr @r1 ; call programming routine nop 1. the general registers other than r0 are saved in the programming program. 2. r0 is a return value of the fpfr parameter. 3. since the stack area is us ed in the programming program, a stack area of maximum 128 bytes must be reserved in ram. (2.12) the return value in the programming program, fpfr (general register r0) is checked. (2.13) determine whether programming of the necessary data has finished. if more than 128 bytes of data are to be programmed, specify fmpar and fmpdr in 128- byte units, and repeat steps (2.10) to (2.13). increment the programming destination address by 128 bytes and update the programming data pointer correctly. if an address which has already been programmed is written to again, not only will a programming error occur, but also flash memory will be damaged. (2.14) after programming finishes, clear fkey and specify software protection. if this lsi is restarted by a power-on reset immediately after user mat programming has finished, secure a reset period (period of res = 0) that is at least as long as the normal 100 s.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 846 of 1080 rej09b0230-0300 (3) erasing procedure in user program mode the procedures for download, initialization, and erasing are shown in figure 20.12. start erasin g procedure pro g ram select on-chip pro g ram to be downloaded and set download destination by ftdar set fkey to h'a5 after clearin g vbr, set sco to 1 and execute download dpfr = 0? yes no download error processin g set the fpefeq and fubra parameters initialization jsr ftdar settin g +32 yes end erasin g procedure pro g ram fpfr=0 ? no initialization error processin g clear fkey to 0 set febs parameter erasin g jsr ftdar settin g +16 yes fpfr=0 ? no clear fkey and erasin g error processin g yes required block erasin g is completed? no set fkey to h'5a clear fkey to 0 (3.1) (3.2) (3.3) (3.4) (3.5) (3.6) 1 1 download initialization erasin g figure 20.12 erasing procedure the details of the erasing procedure are described below. the procedure program must be executed in an area other than the user mat to be erased. especially the part where the sco bit in fccs is set to 1 for downloading must be executed in on- chip ram. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 20.9. 2, areas for storage of the procedural program and data for programming.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 847 of 1080 rej09b0230-0300 the frequency division ratios of an internal clock (i ), a bus clock (b ), and a peripheral clock (p ) should be specified as 1/4 (initial value) by the frequency control register (frqcr). after the programming/erasing program has been downloaded and the sco bit is cleared to 0, the setting of the frequency control register (frqcr) can be changed to the desired value. for the downloaded on-chip program area, see the ram map for programming/erasing in figure 20.10. a single divided block is erased by one erasing processing. for block divisions, see figure 20.4. to erase two or more blocks, update the erase block number and perform the erasing processing for each block. (3.1) select the on-chip program to be downloaded set the epvb bit in fecs to 1. several programming/erasing programs cannot be se lected at one time. if several programs are set, download is not performed and a download error is returned to the source select error detect (ss) bit in the dpfr parameter. specify the start address of the download destination by ftdar. the procedures to be carried out after setting fkey, e.g. download and initialization, are the same as those in the programming procedure. for details, see the description in section 20.5.2 (2), programming procedure in user program mode. (3.2) set the febs parame ter necessary for erasure set the erase block number of the user mat in the flash erase block se lect parameter (febs: general register r4). if a value other than an erase block number of the user mat is set, no block is erased even though the erasing program is executed, and an error is returned to the return value parameter fpfr. (3.3) erasure similar to as in programming, there is an entr y point of the erasing program in the area from (download start address set by ftdar) + 16 bytes of on-chip ram. the subroutine is called and erasing is executed by using the following steps. mov.l #dltop+16,r1 ; set entry address to r1 jsr @r1 ; call erasing routine nop 1. the general registers other than r0 are saved in the erasing program. 2. r0 is a return value of the fpfr parameter.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 848 of 1080 rej09b0230-0300 3. since the stack area is used in the erasing program, a stack area of maximum 128 bytes must be reserved in ram. (3.4) the return value in the erasing program, fpfr (general register r0) is checked. (3.5) determine whether erasure of the necessary blocks has finished. if more than one block is to be erased, update the febs parameter and repeat steps (3.2) to (3.5). blocks that have already b een erased can be erased again. (3.6) after erasure finishes, clear fk ey and specify software protection. if this lsi is restarted by a power-on reset immediately after user mat erasing has finished, secure a reset period (period of res = 0) that is at least as long as the normal 100 s.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 849 of 1080 rej09b0230-0300 (4) erasing and programming procedure in user program mode by changing the on-chip ram address of the download destination in ftdar, the erasing program and programming program can be downloaded to separate on-chip ram areas. figure 20.13 shows an example of repetitively executing ram emulation, erasing, and programming. 1 1 start procedure program set ftdar to h'00 (specify h'ffff9000 as download destination) initialize erasing program download erasing program set ftdar to h'04 (specify h'ffffb000 as download destination) initialize programming program download programming program end ? end procedure program enter ram emulation mode and tune data in on-chip ram confirm operation set fmpdr to h'ffffa000 to program relevant block (execute programming program) cancel ram emulation mode erase relevant block (execute erasing program) programming program download erasing program download emulation/erasing/programming yes no figure 20.13 sample procedure of repeating ram emulation, erasing, and programming (overview)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 850 of 1080 rej09b0230-0300 in the above example, the erasing program and programming program are downloaded to areas excluding addresses (h'ffffa000 to h' ffffafff) to execute ram emulation. download and initialization are performed only once at the beginning. in this kind of operation, note the following: 1. be careful not to destroy on-chip ram with overlapped settings. in addition to the ram emulation area, erasing program area, and programming program area, areas for the user procedure programs, work area, and stack area are reserved in on-chip ram. do not make settings that will overwrite data in these areas. 2. be sure to initialize both the erasing program and programming program. initialization by setting the fpefeq and fubra parameters must be performed for both the erasing program and the programming program. initialization must be executed for both entry addresses: (download start address for eras ing program) + 32 bytes (h'ffff9020 in this example) and (download start address for pr ogramming program) + 32 bytes (h'ffffb020 in this example). 20.5.3 user boot mode this lsi has user boot mode which is initiated with different mode pin settings than those in user program mode or boot mode. user boot mode is a user-arbitrary boot mode, unlike boot mode that uses the on-chip sci. only the user mat can be programmed/erased in user boot mode. programming/erasing of the user boot mat is only enabled in boot mode or programmer mode. (1) user boot mode initiation for the mode pin settings to start up user boot mode, see table 20.1. when the reset start is executed in user boot mode, the check routine for flash-memory related registers runs. the ram area about 1.2 kbyt es from h'ffff9800 and 4 bytes from h'ffffaffc (a stack area) is used by the routine. while the check routine is running, nmi and all other interrupts cannot be accepted. neith er can the aud be used in this period. th is period is 100 s while operating at an internal frequency of 40 mhz. next, processing starts from the execution start address of the reset vector in the user boot mat. at this point, h'aa is set to the flash mat se lect register (fmats) because the execution mat is the user boot mat.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 851 of 1080 rej09b0230-0300 (2) user mat programming in user boot mode for programming the user mat in user boot mode, additional processing made by setting fmats is required: switching from user-boot-mat selected state to user-mat selected state, and switching back to user-boot-mat select ed state after programming completes. figure 20.14 shows the procedure for programming the user mat in user boot mode. select on-chip pro g ram to be downloaded and set download destination by ftdar set fkey to h'a5 dpfr=0 ? yes no download error processin g set the fpefeq and fubra parameters initialization jsr ftdar settin g +32 yes end pro g rammin g procedure pro g ram fpfr=0 ? no initialization error processin g clear fkey to 0 set parameter to r4 and r5 (fmpar and fmpdr) pro g rammin g jsr ftdar settin g +16 yes fpfr=0 ? no yes required data pro g rammin g is completed? no set fkey to h'5a clear fkey to 0 1 1 download initialization pro g rammin g mat switchover mat switchover set fmats to value other than h'aa to select user mat after clearin g vbr, set sco to 1 and execute download clear fkey and pro g rammin g error processin g * set fmats to h'aa to select user boot mat user-boot-mat selection state user-mat selection state user-boot-mat selection state note: * the mat must be switched by fmats to perform the pro g rammin g error processin g in the user boot mat. start pro g rammin g procedure pro g ram figure 20.14 procedure for programming user mat in user boot mode
section 20 flash memory rev. 3.00 oct. 06, 2008 page 852 of 1080 rej09b0230-0300 the difference between the programming procedures in user program mode and user boot mode is whether the mat is switched or not as shown in figure 20.14. in user boot mode, the user boot mat can be seen in the flash memory space with the user mat hidden in the background. the user mat and user boot mat are switched only while the user mat is being programmed. because the user boot mat is hidden while the user mat is being programmed, the procedure program must be located in an area other than flash memory. after programming finishes, switch the mats again to return to the first state. mat switchover is enabled by writing a specific va lue to fmats. however note that while the mats are being switched, the lsi is in an unstabl e state, e.g. access to a mat is not allowed until mat switching is completely finished, and if an interrupt occurs, from which mat the interrupt vector is read from is undetermined. perform mat switching in accordance with the description in section 20.8.1, switching between user mat and user boot mat. except for mat switching, the programming procedure is the same as that in user program mode. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 20.9. 2, areas for storage of the procedural program and data for programming.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 853 of 1080 rej09b0230-0300 (3) user mat erasing in user boot mode for erasing the user mat in user boot mode, additional processings made by setting fmats are required: switching from user-boot-mat selected state to user-mat selected state, and switching back to user-boot-mat selected state after erasing completes. figure 20.15 shows the procedure for erasing the user mat in user boot mode. start erasin g procedure pro g ram select on-chip pro g ram to be downloaded and set download destination by ftdar set fkey to h'a5 dpfr=0 ? yes no download error processin g set the fpefeq and fubra parameters initialization jsr ftdar settin g +32 yes end erasin g procedure pro g ram fpfr=0 ? no initialization error processin g clear fkey to 0 set febs parameter pro g rammin g jsr ftdar settin g +16 yes fpfr=0 ? no clear fkey and erasin g error processin g * yes required block erasin g is completed? no set fkey to h'5a clear fkey to 0 1 1 download initialization erasin g set fmats to value other than h'aa to select user mat after clearin g vbr, set sco to 1 and execute download set fmats to h'aa to select user boot mat user-boot-mat selection state user-mat selection state user-boot-mat selection state note: * the mat must be switched by fmats to perform the erasin g error processin g in the user boot mat. mat switchover mat switchover figure 20.15 procedure for erasing user mat in user boot mode
section 20 flash memory rev. 3.00 oct. 06, 2008 page 854 of 1080 rej09b0230-0300 the difference between the erasing procedures in user program mode and user boot mode depends on whether the mat is switched or not as shown in figure 20.14. mat switching is enabled by writing a specific value to fmats. however note that while the mats are being switched, the lsi is in an unstabl e state, e.g. access to a mat is not allowed until mat switching is completed finished, and if an interrupt occurs, from which mat the interrupt vector is read from is undetermined. perform mat switching in accordance with the description in section 20.8.1, switching between user mat and user boot mat. except for mat switching, the erasing procedure is the same as that in user program mode. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 20.9. 2, areas for storage of the procedural program and data for programming.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 855 of 1080 rej09b0230-0300 20.6 protection there are three kinds of flash memory program/ erase protection: hardwa re, software, and error protection. 20.6.1 hardware protection programming and erasing of flash memory is forcibly disabled or suspended by hardware protection. in this state, the downloading of an on-chip program and initialization of the flash memory are possible. however, an activated program for programming or erasure cannot program or erase locations in a user mat, and the error in programming/erasing is reported in the fpfr parameter. table 20.9 hardware protection function to be protected item description download programming/ erasure fwe-pin protection the input of a low-level signal on the fwe pin clears the fwe bit of fccs and the lsi enters a programming/erasing-protected state. ? reset/standby protection ? a power-on reset (including a power-on reset by the wdt) and entry to standby mode initializes the programming/erasing interface registers and the lsi enters a programming/erasing-protected state. ? resetting by means of the res pin after power is initially supplied will not make the lsi enter the reset state unless the res pin is held low until oscillation has stabilized. in the case of a reset during operation, hold the res pin low for the res pulse width that is specified in the section on ac characteristics. if the lsi is reset during programming or erasure, data in the flash memory is not guaranteed. in this case, execute erasure and then execute programming again.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 856 of 1080 rej09b0230-0300 20.6.2 software protection software protection is set up in any of three ways: by disabling the downloading of on-chip programs for programming and erasing, by means of a key code, and by the ram emulation register (ramer). table 20.10 software protection function to be protected item description download programming/ erasure protection by the sco bit clearing the sco bit in fccs disables downloading of the programming/erasing program, thus making the lsi enter a programming/erasing-protected state. protection by fkey downloading and programming/erasing are disabled unless the required key code is written in fkey. different key codes are used for downloading and for programming/erasing. emulation protection setting the rams bit in ramer to 1 makes the lsi enter a programming/erasing-protected state. 20.6.3 error protection error protection is a mechanism for aborting program ming or erasure when an error occurs, in the form of the microcomputer getting out of control during programming/erasing of the flash memory or operations that are not in accord ance with the established procedures for programming/erasing. aborting programming or eras ure in such cases prevents damage to the flash memory due to excessive programming or erasing. if the microcomputer malfunctions during programming/erasing of the flash memory, the fler bit in fccs is set to 1 and the lsi enters the error protection state, thus aborting programming or erasure.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 857 of 1080 rej09b0230-0300 the fler bit is set to 1 in the following conditions: 1. when the relevant bank area of flash memory is read during programming/erasing (including a vector read or an instruction fetch) 2. when a sleep instruction (including so ftware standby mode) is executed during programming/erasing error protection is cancelled (fler bit is cleared) only by a power-on reset or in hardware standby mode. note that the reset signal should only be released after providing a reset input over a period longer than the normal 100 s. since high voltages are applied during programming/erasing of the flash memory, some voltage may still remain even after the error protection state has been entered. for this reason, it is necessary to reduce the risk of damage to the flash memory by extending the reset period so that the charge is released. the state-transition diagram in figure 20.16 shows transitions to and from the error protection state. reset or standby (hardware protection) pro g ram mode erase mode error protection mode error protection mode (software standby) read disabled pro g rammin g /erasin g enabled fler = 0 read enabled pro g rammin g /erasin g disabled fler = 0 read enabled pro g rammin g /erasin g disabled fler = 1 read disabled pro g rammin g /erasin g disabled fler = 1 res = 0 or hstby = 0 error occurred error occ urred (softw are stand by) res = 0 or hstby = 0 software standby mode cancel software standby mode res = 0 or hstby = 0 pro g rammin g /erasin g interface re g ister is in its initial state. pro g rammin g /erasin g interface re g ister is in its initial state. figure 20.16 transitions to and from error protection state
section 20 flash memory rev. 3.00 oct. 06, 2008 page 858 of 1080 rej09b0230-0300 20.7 flash memory emulation in ram to provide real-time emulation in ram of data that is to be written to the flash memory, a part of the ram can be overlaid on an area of flash memo ry (user mat) that has been specified by the ram emulation register (ramer). after the ra mer setting is made, the ram is accessible in both the user mat area and as the ram area that has been overlaid on the user mat area. such emulation is possible in user mode and user program mode. figure 20.17 shows an example of the emulation of realtime programming of the user mat area. start of emulation pro g ram set ramer write the data for tunin g to the overlapped ram area execute application pro g ram tunin g ok? cancel ramer settin g pro g ram the emulation block in the user mat end of emulation pro g ram yes no figure 20.17 emulation of flash memory in ram
section 20 flash memory rev. 3.00 oct. 06, 2008 page 859 of 1080 rej09b0230-0300 h'ffffa000 h'ffffafff h'ffffbfff h'ffff9fff on-chip ram eb0 h'00000 eb1 h'01000 eb2 h'02000 eb3 h'03000 eb4 h'04000 eb5 h'05000 eb6 h'06000 eb7 h'07000 h'08000 h'3ffff flash memory (user mat) eb8 to eb11 h'ffff9000 on-chip ram this area is accessible as both a ram area and as a flash memory area. figure 20.18 example of overlapped ram operation (256-kbyte flash memory version) figure 20.18 shows an example of an overlap on block area eb0 of the flash memory. emulation is possible for a single area selected from among the eight areas, from eb0 to eb7, of the user mat. the area is selected by the setting of the ram2 to ram0 bits in ramer. 1. to overlap a part of the ram on area eb0, to allow realtime programming of the data for this area, set the rams bit in ramer to 1, and each of the ram2 to ram0 bits to 0. 2. realtime programming is carried out using the overlaid area of ram. in programming or erasing the user mat, it is necessary to run a program that implements a series of procedural steps, including the downloading of an on-chip program. in this process, set the download area with ftdar so that the overla id ram area and the area where the on-chip program is to be downloaded do not overlap. figure 20.19 shows an example of programming data that has been emulated to the eb0 area in the user mat.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 860 of 1080 rej09b0230-0300 eb0 h'00000 eb1 h'01000 eb2 h'02000 eb3 h'03000 eb4 h'04000 eb5 h'05000 eb6 h'06000 eb7 h'07000 h'08000 h'3ffff flash memory (user mat) eb8 to eb11 h'ffffa000 h'ffffafff ftdar settin g h'ffffbfff download area pro g rammin g /erasin g procedure pro g ram area (1) cancel the emulation mode. (2) transfer the user pro g rammin g /erasin g procedure pro g ram. (3) download the on-chip pro g rammin g / erasin g pro g ram to the destination set by ftdar without overlappin g the tuned data area. (4) execute pro g rammin g after erasin g . tuned data area figure 20.19 programming of tuned data (256-kbyte flash memory version) 1. after the data to be programmed has fixed values, clear the rams bit to 0 to cancel the overlap of ram. emulation mode is canceled and emulation protection is also cleared. 2. transfer the user programming/erasing procedure program to ram. 3. run the programming/erasing procedure program in ram and download the on-chip programming/erasing program. specify the download st art address with ftdar so that the tuned data area does not overlap with the download area. 4. when the eb0 area of the user mat has not been erased, erasing must be performed before programming. set the parameters fmpar and fmpdr so that the tuned data is designated, and execute programming. note: setting the rams bit to 1 puts all the blocks in flash memory in the programming/erasing-protected state regardless of the values of the ram2 to ram0 bits (emulation protection). clear the rams bit to 0 before actual programming or erasure. though ram emulation can also be carried out with the user boot mat selected, the user boot mat can be erased or programmed only in boot mode or programmer mode.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 861 of 1080 rej09b0230-0300 20.8 usage notes 20.8.1 switching between user mat and user boot mat it is possible to switch between the user mat and user boot mat. however, the following procedure is required because these mats are allocated to address 0. (switching to the user boot mat disables programming and erasing. programming of the user boot mat must take place in boot mode or programmer mode.) 1. mat switching by fmats should always be executed from the on-chip ram. the sh microcomputer prefetches execution instructions. therefore, a switchover during program execution in the user mat causes an instruction c ode in the user mat to be prefetched or an instruction in the newly selected user boot mat to be prefetched, thus resulting in unstable operation. 2. to ensure that the mat that has been switche d to is accessible, execute four nop instructions in on-chip ram immediately after writing to fm ats of on-chip ram (this prevents access to the flash memory during mat switching). 3. if an interrupt occurs during switching, there is no guarantee of which memory mat is being accessed. always mask the maskable interrupts before switching mats. in addition, configuring the system so that nmi interrupts do not occur during mat switching is recommended. 4. after the mats have been switched, take care because the interrupt vector table will also have been switched. if the same interrupt processings are to be executed before and after mat switching or interrupt requests cannot be disabled, transfer the interrupt processing routine to on-chip ram, and use the vbr setting to place the interrupt vector table in on chip ram. in this case, make sure the vbr setting change does not conflict with the interrupt occurrence. 5. memory sizes of the user mat and user boot mat are different. when accessing the user boot mat, do not access addresses exceedi ng the 12-kbyte memory space. if access goes beyond the 12-kbyte space, the values read are undefined.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 862 of 1080 rej09b0230-0300 < user mat >< on-chip ram >< user boot mat > procedure for switchin g to the user boot mat procedure for switchin g to the user mat procedure for switchin g to the user boot mat (1) mask interrupts. (2) write h'aa to fmats. (3) execute four nop instructions before accessin g the user boot mat. procedure for switchin g to the user mat (1) mask interrupts. (2) write a value other than h'aa to fmats. (3) execute four nop instructions before accessin g the user mat. figure 20.20 switching between user mat and user boot mat 20.8.2 interrupts during programming/erasing (1) download of on-chip program (1.1) vbr setting change before downloading the on-chip program, vbr must be set to h'84000000. if vbr is set to a value other than h'84000000, the interrupt vector table is placed in the user mat (fmats is not h'aa) or the user boot mat (fmats is h'aa) on setting h'84000000 to vbr. when vbr setting change conflicts with interrupt occurrence, whether the vector table before or after vbr is changed is referenced may cause an error. therefore, for cases where vbr setting change ma y conflict with interrupt occurrence, prepare a vector table to be referenced when vbr is h'00000000 (in itial value) at the start of the user mat or user boot mat.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 863 of 1080 rej09b0230-0300 (1.2) sco download request and interrupt request download of the on-chip programming/erasing program that is initiated by setting the sco bit in fccs to 1 generates a particular inte rrupt processing accompanied by mat switchover. operation when the sco download request and inte rrupt request conflicts is described below. 1. contention between sco download request and interrupt request figure 20.21 shows the timing of contention between execution of the instruction that sets the sco bit in fccs to 1 and interrupt acceptance. n n+1 n+2 n+3 n+4 fetch decoding execution execution execution (a) (b) cpu cycle cpu operation for instruction that sets sco bit to 1 (a) when the interrupt is accepted at the (n + 1) cycle or before after the interrupt processing completes, the sco bit is set to 1 and download is executed. (b) when the interrupt is accepted at the (n + 2) cycle or later the interrupt will conflicts with the sco download request. ensure that no interrupt is generated. interrupt acceptance figure 20.21 timing of contention between sco download request and interrupt request 2. generation of interrupt requests during downloading ensure that interrupts are not generated during downloading that is initiated by the sco bit. (2) interrupts during programming/erasing interrupts during execution of write or erase operations with a downloaded on-chip program and acquisition of bus rights by bus masters other than the cpu are forbidden.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 864 of 1080 rej09b0230-0300 20.8.3 other notes (1) download time of on-chip program the programming program that includes the initialization routine and the erasing program that includes the initialization routine are each 3 kbytes or less. accordingly, when the cpu clock frequency is 20 mhz, the download for each progra m takes approximately 10 ms at maximum. (2) user branch processing intervals the intervals for executing the us er branch processing differs in programming and erasing. the processing phase also differs. table 20.11 lists the maximum intervals for initiating the user branch processing when the cpu clock frequency is 64 to 80 mhz. table 20.11 initiation intervals of user branch processing processing name maximum interval programming approximately 2 ms erasing approximately 15 ms however, when operation is done with cpu clock of 64 to 80 mhz, the maximum values of the time until first user branch processing are as shown in table 20.12. table 20.12 initial user branch processing time processing name max. programming approximately 2 ms erasing approximately 15 ms (3) write to flash-memory rel ated registers by dtc while an instruction in on-chip ram is being executed, the dtc can write to the sco bit in fccs that is used for a download request or fmats that is used for mat switching. make sure that these registers are not accidentally written to, otherwise an on-chip program may be downloaded and destroy ram or a mat switchover may occur and the cpu get out of control.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 865 of 1080 rej09b0230-0300 (4) state in which int errupts are ignored in the following modes or period, interrupt requests are ignored; they are not executed and the interrupt sources are not retained. ? boot mode ? programmer mode (5) note on programming the product having a 384-kbyte/256-kbyte user mat if an attempt is made to program the product having a 384-kbyte user mat with more than 384 kbytes, data programmed after the first 384 kbytes are not guaranteed. if an attempt is made to program the product having a 256-kbyte user mat with more than 256 kbytes, data programmed after the first 256 kbytes are not guaranteed. (6) compatibility with programming/erasing program of conventional f-ztat sh microcomputer a programming/erasing program for flash memory used in the conventional f-ztat sh microcomputer which does not support download of the on-chip program by a sco transfer request cannot run in this lsi. be sure to download the on-chip program to execute programming/erasing of flash memory in this lsi. (7) monitoring runaway by wdt unlike the conventional f-ztat sh microcomputer, no countermeasures are available for a runaway by wdt during programming/erasing by the downloaded on-chip program. prepare countermeasures (e.g. use of the user br anch routine and periodic timer interrupts) for wdt while taking the programming/erasing time into consideration as required. (8) stack address the stack start address must be in intern al ram during write or erase operations. (9) illegal access areas when the ram emulation function is used when the ram emulation function is used, accesses to the areas listed in table 20.13 are illegal.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 866 of 1080 rej09b0230-0300 table 20.13 illegal access areas during ram emulation function use eb0 selected eb1 selected eb2 sel ected eb3 selected eb4 selected eb5 selected eb6 selected eb7 selected h'00008000 to h'00008fff h'00009000 to h'00009fff h'0000a000 to h'0000afff h'0000b000 to h'0000bfff h'0000c000 to h'0000cfff h'0000d000 to h'0000dfff h'0000e000 to h'0000efff h'0000f000 to h'0000ffff h'00010000 to h'00010fff h'00011000 to h'00011fff h'00012000 to h'00012fff h'00013000 to h'00013fff h'00014000 to h'00014fff h'00015000 to h'00015fff h'00016000 to h'00016fff h'00017000 to h'00017fff h'00018000 to h'00018fff h'00019000 to h'00019fff h'0001a000 to h'0001afff h'0001b000 to h'0001bfff h'0001c000 to h'0001cfff h'0001d000 to h'0001dfff h'0001e000 to h'0001efff h'0001f000 to h'0001ffff h'00020000 to h'00020fff h'00021000 to h'00021fff h'00022000 to h'00022fff h'00023000 to h'00023fff h'00024000 to h'00024fff h'00025000 to h'00025fff h'00026000 to h'00026fff h'00027000 to h'00027fff h'00028000 to h'00028fff h'00029000 to h'00029fff h'0002a000 to h'0002afff h'0002b000 to h'0002bfff h'0002c000 to h'0002cfff h'0002d000 to h'0002dfff h'0002e000 to h'0002efff h'0002f000 to h'0002ffff h'00030000 to h'00030fff h'00031000 to h'00031fff h'00032000 to h'00032fff h'00033000 to h'00033fff h'00034000 to h'00034fff h'00035000 to h'00035fff h'00036000 to h'00036fff h'00037000 to h'00037fff h'00038000 to h'00038fff h'00039000 to h'00039fff h'0003a000 to h'0003afff h'0003b000 to h'0003bfff h'0003c000 to h'0003cfff h'0003d000 to h'0003dfff h'0003e000 to h'0003efff h'0003f000 to h'0003ffff h'00040000 to h'00040fff h'00041000 to h'00041fff h'00042000 to h'00042fff h'00043000 to h'00043fff h'00044000 to h'00044fff h'00045000 to h'00045fff h'00046000 to h'00046fff h'00047000 to h'00047fff h'00048000 to h'00048fff h'00049000 to h'00049fff h'0004a000 to h'0004afff h'0004b000 to h'0004bfff h'0004c000 to h'0004cfff h'0004d000 to h'0004dfff h'0004e000 to h'0004efff h'0004f000 to h'0004ffff h'00050000 to h'00050fff h'00051000 to h'00051fff h'00052000 to h'00052fff h'00053000 to h'00053fff h'00054000 to h'00054fff h'00055000 to h'00055fff h'00056000 to h'00056fff h'00057000 to h'00057fff h'00058000 to h'00058fff h'00059000 to h'00059fff h'0005a000 to h'0005afff h'0005b000 to h'0005bfff h'0005c000 to h'0005cfff h'0005d000 to h'0005dfff h'0005e000 to h'0005efff h'0005f000 to h'0005ffff h'00060000 to h'00060fff h'00061000 to h'00061fff h'00062000 to h'00062fff h'00063000 to h'00063fff h'00064000 to h'00064fff h'00065000 to h'00065fff h'00066000 to h'00066fff h'00067000 to h'00067fff h'00068000 to h'00068fff h'00069000 to h'00069fff h'0006a000 to h'0006afff h'0006b000 to h'0006bfff h'0006c000 to h'0006cfff h'0006d000 to h'0006dfff h'0006e000 to h'0006efff h'0006f000 to h'0006ffff illegal access area h'00070000 to h'00070fff h'00071000 to h'00071fff h'00072000 to h'00072fff h'00073000 to h'00073fff h'00074000 to h'00074fff h'00075000 to h'00075fff h'00076000 to h'00076fff h'00077000 to h'00077fff h'00078000 to h'00078fff h'00079000 to h'00079fff h'0007a000 to h'0007afff h'0007b000 to h'0007bfff h'0007c000 to h'0007cfff h'0007d000 to h'0007dfff h'0007e000 to h'0007efff h'0007f000 to h'0007ffff
section 20 flash memory rev. 3.00 oct. 06, 2008 page 867 of 1080 rej09b0230-0300 20.9 supplementary information 20.9.1 specifications of the standa rd serial communications interface in boot mode the boot program activated in boot mode communicates with the host via the on-chip sci of the lsi. the specifications of the serial communications interface be tween the host and the boot program are described below. ? states of the boot program the boot program has three states. 1. bit-rate matching state in this state, the boot program adjusts the bit rate to match that of the host. when the chip starts up in boot mode, the boot program is activated and enters the bit-rate matching state, in which it receives commands from the host and adju sts the bit rate accordin gly. after bit-rate matching is complete, the boot program pro ceeds to the inquiry-and-selection state. 2. inquiry-and-selection state in this state, the boot program responds to inquiry commands from the host. the device, clock mode, and bit rate are selected in this state. after making these selections, the boot program enters the programming/erasure state in res ponse to the transition-to-programming/erasure state command. the boot program transfers the erasure program to ram and executes erasure of the user mat and user boot mat before it enters the programming/erasure state. 3. programming/erasure state in this state, programming/erasure are executed. the boot program transfers the program for programming/erasure to ram in line with the co mmand received from the host and executes programming/erasure. it also performs sum ch ecking and blank checking as directed by the respective commands.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 868 of 1080 rej09b0230-0300 figure 20.22 show the flow of processing by the boot program. wait for pro g rammin g /erasure selection erase user mat/use boot mat bit rate matchin g wait for inquiry and selection selection processin g inquiry processin g pro g rammin g processin g erasure processin g checkin g processin g pro g rammin g erasure checkin g reset inquiry enter pro g rammin g /erasure state selection bit rate matchin g state inquiry-and-selection state pro g rammin g /erasure state figure 20.22 flow of processing by the boot program ? bit-rate matching state in bit-rate matching, the boot program measures the low-level intervals in a signal carrying h'00 data that is transmitted by the host, and calculates the bit rate from this. the bit rate can be changed by the new-bit-rate selection command. on completion of bit-rate matching, the boot program goes to the inquiry and selection state. the sequence of processing in bit-rate matching is shown in figure 20.23.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 869 of 1080 rej09b0230-0300 host boot pro g ram h'00 (max. 30 times) h'00 (bit rate matchin g complete) h'55 h'e6 (response) h'ff (error) measures the len g th of one bit figure 20.23 sequence of bit-rate matching ? communications protocol formats in the communications protocol between the host and boot program after completion of the bit-rate matching are as follows. 1. one-character command or one-character response a command or response consisting of a single character used for an inquiry or the ack code indicating normal completion. 2. n-character command or n-character response a command or response that requires n bytes of data, which is used as a selection command or response to an inquiry. the length of programming data is treated separately below. 3. error response response to a command in case of an error: two bytes, consisting of the error response and error code. 4. 128-byte programming command the command itself does not include data-size information. the data length is known from the response to the command for inquiring about the programming size. 5. response to a memory reading command this response includes four bytes of size information.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 870 of 1080 rej09b0230-0300 command or response data data (n bytes) address size checksum command or response command error code error response checksum data data size response checksum one-character command or one-character response n-character command or n-character response error response 128-byte pro g rammin g command response to memory read command figure 20.24 formats in the communications protocol ? command (1 byte): inquiry, selection, programming, erasure, checking, etc. ? response (1 byte): response to an inquiry ? size (one or two bytes): the length of data for transfer, excluding the command/response code, size, and checksum. ? data (n bytes): particular data for the command or response ? checksum (1 byte): set so that the total sum of byte values from the command code to the checksum is h'00. ? error response (1 byte): error response to a command ? error code (1 byte): indicates the type of error. ? address (4 bytes): address for programming ? data (n bytes): data to be programmed. "n" is known from the response to the command used to inquire about the programming size. ? data size (4 bytes): four-byte field incl uded in the response to a memory reading command.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 871 of 1080 rej09b0230-0300 ? inquiry-and-selection state in this state, the boot program returns information on the flash rom in response to inquiry commands sent from the host, and selects the device, clock mode, and bit rate in response to the respective selection commands. the inquiry and selection commands are listed in table 20.14. table 20.14 inquiry and selection commands command command name function h'20 inquiry on supported devices requests the device codes and their respective boot program names. h'10 device selection selects a device code. h'21 inquiry on clock modes requests the number of available clock modes and their respective values. h'11 clock-mode selection selects a clock mode. h'22 inquiry on frequency multipliers requests the number of clock signals for which frequency multipliers and divisors are selectable, the number of multiplier and divisor settings for the respective clocks, and the values of the multipliers and divisors. h'23 inquiry on operating frequency requests the minimum and maximum values for operating frequency of the main clock and peripheral clock. h'24 inquiry on user boot mats requests the number of user boot mat areas along with their start and end addresses. h'25 inquiry on user mats requests the number of user mat areas along with their start and end addresses. h'26 inquiry on erasure blocks requests the number of erasure blocks along with their start and end addresses. h'27 inquiry on programming size requests the unit of data for programming. h'3f new bit rate selection selects a new bit rate. h'40 transition to programming/erasure state on receiving this command, the boot program erases the user mat and user boot mat and enters the programming/erasure state. h'4f inquiry on boot program state requests information on the current state of boot processing. the selection commands should be sent by the host in this order: device selection (h'10), clock- mode selection (h'11), new bit rate selection (h'3f). these commands are mandatory. if the same selection command is sent two or more times, the command that is sent last is effective.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 872 of 1080 rej09b0230-0300 all commands in the above table, except for the boot program state inquiry command (h'4f), are valid until the boot program accepts the transiti on-to-programming/erasure state command (h'40). that is, until the transition command is accepted, th e host can continue to send commands listed in the above table until it has made the necessary in quiries and selections. the host can send the boot program state inquiry command (h'4f) even after acceptance of the transition-to- programming/erasure state command (h'40) by the boot program. (1) inquiry on supported devices in response to the inquiry on supported devices, the boot program returns the device codes of the devices it supports and the product names of their respective boot programs. command h'20 ? command h'20 (1 byte): inquiry on supported devices response h'30 size no. of devices number of characters device code product name ? sum ? response h'30 (1 byte): response to the inquiry on supported devices ? size (1 byte): the length of data for transfer excluding the command code, this field (size), and the checksum. here, it is the total number of bytes taken up by the number of devices, number of characters, device code, and product name fields. ? number of devices (1 byte): the number of device models supported by the boot program embedded in the microcomputer. ? number of characters (1 byte): the number of characters in the device code and product name fields. ? device code (4 bytes): device code of a supported device (ascii encoded) ? product name (n bytes): product code of the boot program (ascii encoded) ? sum (1 byte): checksum this is set so that the total sum of all bytes from the command code to the checksum is h'00.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 873 of 1080 rej09b0230-0300 (2) device selection in response to the device selection command, the boot program sets the specified device as the selected device. the boot program will return the information on the selected device in response to subsequent inquiries. command h'10 size device code sum ? command h'10 (1 byte): device selection ? size (1 byte): number of characters in the device code (fixed at 2) ? device code (4 bytes): a device code that was returned in response to an inquiry on supported devices (ascii encoded) ? sum (1 byte): checksum response h'06 ? response h'06 (1 byte): response to device selection this is the ack code and is returned when the specified device code matches one of the supported devices. error response h'90 error ? error response h'90 (1 byte): error response to device selection ? error (1 byte): error code h'11: sum-check error h'21: non-matching device code (3) inquiry on clock modes in response to the inquiry on clock modes, the boot program returns the number of available clock modes. command h'21 ? command h'21 (1 byte): inquiry on clock modes response h'31 size mode ? sum
section 20 flash memory rev. 3.00 oct. 06, 2008 page 874 of 1080 rej09b0230-0300 ? response h'31 (1 byte): response to the inquiry on clock modes ? size (1 byte): the total length of the number of modes and mode data fields. ? mode (1 byte): selectable clock mode (example: h'01 denotes clock mode 1) ? sum (1 byte): checksum (4) clock-mode selection in response to the clock-mode selection comma nd, the boot program sets the specified clock mode. the boot program will return the information on the selected clock mode in response to subsequent inquiries. command h'11 size mode sum ? command h'11 (1 byte): clock mode selection ? size (1 byte): number of characters in the clock-m ode field (fixed at 1) ? mode (1 byte): a clock mode returned in response to the inquiry on clock modes ? sum (1 byte): checksum response h'06 ? response h'06 (1 byte): response to clock mode selection this is the ack code and is returned when the specified clock-mode matches one of the available clock modes. error response h'91 error ? error response h'91 (1 byte): error response to clock mode selection ? error (1 byte): error code h'11: sum-check error h'21: non-matching clock mode
section 20 flash memory rev. 3.00 oct. 06, 2008 page 875 of 1080 rej09b0230-0300 (5) inquiry on frequency multipliers in response to the inquiry on frequency multiplie rs, the boot program returns information on the settable frequency multipliers or divisors. command h'22 ? command h'22 (1 byte): inquiry on frequency multipliers response h'32 size no. of operating clocks no. of multipliers multiplier ? ? sum ? response h'32 (1 byte): response to the inquiry on frequency multipliers ? size (1 byte): the total length of the number of operating clocks, number of multipliers, and multiplier fields. ? number of operating clocks (1 byte): the number of operating clocks for which multipliers can be selected (for example, if frequency multiplier settings can be made for the frequencies of the main and peripheral operating clocks, the value should be h'02). ? number of multipliers (1 byte): the number of multipliers selectable for the operating frequency of the main or peripheral modules ? multiplier (1 byte): multiplier: numerical value in the case of frequency multiplication (e.g. h'04 for 4) divisor: two?s complement negative numerical value in the case of frequency division (e.g. h'fe [-2] for 1/2) as many multiplier fields are included as there are multipliers or divisors, and combinations of the number of multipliers and multiplier fields are repeated as many times as there are operating clocks. ? sum (1 byte): checksum
section 20 flash memory rev. 3.00 oct. 06, 2008 page 876 of 1080 rej09b0230-0300 (6) inquiry on operating frequency in response to the inquiry on operating frequency, the boot program returns the number of operating frequencies and the maximum and minimum values. command h'23 ? command h'23 (1 byte): inquiry on operating frequency response h'33 size no. of operating clocks operating freq. (min) operating freq. (max) ? sum ? response h'33 (1 byte): response to the inquiry on operating frequency ? size (1 byte): the total length of the number of operating clocks, and maximum and minimum values of operating frequency fields. ? number of operating clocks (1 byte): the number of operating clock frequencies required within the device. for example, the value two indicates main and peripheral operating clock frequencies. ? minimum value of operating frequency (2 bytes): the minimum frequency of a frequency- multiplied or -divided clock signal. the value in this field and in the maximum value field is the frequency in mhz to two decimal places, multiplied by 100 (for example, if the frequency is 20.00 mhz, the value multiplied by 100 is 2000, so h'07d0 is returned here). ? maximum value of operating frequency (2 byt es): the maximum frequency of a frequency- multiplied or -divided clock signal. as many pairs of minimum/maximum values are included as there are operating clocks. ? sum (1 byte): checksum
section 20 flash memory rev. 3.00 oct. 06, 2008 page 877 of 1080 rej09b0230-0300 (7) inquiry on user boot mats in response to the inquiry on user boot mats, the boot program returns the number of user boot mat areas and their addresses. command h'24 ? command h'24 (1 byte): inquiry on user boot mat information response h'34 size no. of areas first address of the area last address of the area ? sum ? response h'34 (1 byte): response to the inquiry on user boot mats ? size (1 byte): the total length of the number of areas and first and last address fields. ? number of areas (1 byte): the number of user boot mat areas. h'01 is returned if the entire user boot mat area is continuous. ? first address of the area (4 bytes) ? last address of the area (4 bytes) as many pairs of first and last addre ss field are included as there are areas. ? sum (1 byte): checksum (8) inquiry on user mats in response to the inquiry on user mats, the boot program returns the number of user mat areas and their addresses. command h'25 ? command h'25 (1 byte): inquiry on user mat information response h'35 size no. of areas first address of the area last address of the area ? sum
section 20 flash memory rev. 3.00 oct. 06, 2008 page 878 of 1080 rej09b0230-0300 ? response h'35 (1 byte): response to the inquiry on user mats ? size (1 byte): the total length of the number of areas and first and last address fields. ? number of areas (1 byte): the number of user mat areas. h'01 is returned if the entire user mat area is continuous. ? first address of the area (4 bytes) ? last address of the area (4 bytes) as many pairs of first and last addre ss field are included as there are areas. ? sum (1 byte): checksum (9) inquiry on erasure blocks in response to the inquiry on erasure blocks, the boot program returns the number of erasure blocks in the user mat and the addresses where each block starts and ends. command h'26 ? command h'26 (1 byte): inquiry on erasure blocks response h'36 size no. of blocks first address of the block last address of the block ? sum ? response h'36 (1 byte): response to the inquiry on erasure blocks ? size (2 bytes): the total length of the number of blocks and first and last address fields. ? number of blocks (1 byte): the number of erasure blocks in flash memory ? first address of the block (4 bytes) ? last address of the block (4 bytes) as many pairs of first and last address data are included as there are blocks. ? sum (1 byte): checksum
section 20 flash memory rev. 3.00 oct. 06, 2008 page 879 of 1080 rej09b0230-0300 (10) inquiry on programming size in response to the inquiry on programming size, the boot program returns the size, in bytes, of the unit for programming. command h'27 ? command h'27 (1 byte): inquiry on programming size response h'37 size programming size sum ? response h'37 (1 byte): response to the inquiry on programming size ? size (1 byte): the number of characters in the programming size field (fixed at 2) ? programming size (2 bytes): the size of the unit for programming this is the unit for the reception of data to be programmed. ? sum (1 byte): checksum (11) new bit rate selection in response to the new-bit-rate selection command, the boot program changes the bit rate setting to the new bit rate and, if the setting was successful, responds to the ack sent by the host by returning another ack at the new bit rate. the new-bit-rate selection command should be sent after clock-mode selection. command h'3f size bit rate input frequency no. of multipliers multiplier 1 multiplier 2 sum ? command h'3f (1 byte): new bit rate selection ? size (1 byte): the total length of the bit ra te, input frequency, number of multipliers, and multiplier fields ? bit rate (2 bytes): new bit rate the bit rate value divided by 100 should be set here (for example, to select 19200 bps, the set h'00c0, which is 192 in decimal notation). ? input frequency (2 bytes): the frequency of the clock signal fed to the boot program this should be the frequency in mhz to the second decimal place, multiplied by 100 (for example, if the frequency is 28.882 mhz, the values is truncated to the second decimal place and multiplied by 100, making 2888; so h'0b48 should be set in this field).
section 20 flash memory rev. 3.00 oct. 06, 2008 page 880 of 1080 rej09b0230-0300 ? number of multipliers (1 byte): the number of selectable frequency multipliers and divisors for the device. this is normally 2, which indicates the main operating frequency and the operating frequency of the peripheral modules. ? multiplier 1 (1 byte): multiplier or divisor for the main operating frequency multiplier: numerical value of the frequency multiplier (e.g. h'04 for 4) divisor: two?s complement negative numerical value in the case of frequency division (e.g. h'fe [-2] for 1/2) ? multiplier 2 (1 byte): multiplier or divisor for the peripheral operating frequency multiplier: numerical value of the frequency multiplier (e.g. h'04 for 4) divisor: two?s complement negative numerical value in the case of frequency division (e.g. h'fe [-2] for 1/2) ? sum (1 byte): checksum response h'06 ? response h'06 (1 byte): response to the new-bit-rate selection command this is the ack code and is returned if the specified bit rate was selectable. error response h'bf error ? error response h'bf (1 byte): error response to new bit rate selection ? error (1 byte): error code h'11: sum-check error h'24: bit rate selection error (the specified bit rate is not selectable). h'25: input frequency error (the specified input frequency is not within the range from the minimum to the maximum value). h'26: frequency multiplier error (the specified multiplier does not match an available one). h'27: operating frequency error (the specified operating frequency is not within the range from the minimum to the maximum value).
section 20 flash memory rev. 3.00 oct. 06, 2008 page 881 of 1080 rej09b0230-0300 the received data are checked in the following ways. 1. input frequency the value of the received input frequency is check ed to see if it is w ithin the range of the minimum and maximum values of input frequency for the selected clock mode of the selected device. a value outside the range generates an input frequency error. 2. multiplier the value of the received multiplier is checked to see if it matches a multiplier or divisor that is available for the selected clock mode of the selected device. a value that does not match an available ratio generates a frequency multiplier error. 3. operating frequency the operating frequency is calculated from th e received input frequency and the frequency multiplier or divisor. the input frequency is the frequency of the clock signal supplied to the lsi, while the operating frequency is the frequency at which the lsi is actually driven. the following formulae are used for this calculation. operating frequency = input frequency multiplier, or operating frequency = input frequency / divisor the calculated operating frequency is checked to see if it is within the range of the minimum and maximum values of the operating frequency for the selected clock mode of the selected device. a value outside the range gene rates an operating frequency error. 4. bit rate from the peripheral operating frequency (p ) and the bit rate (b), the value (= n) of the clock select bits (cks) in the serial mode register (scsmr) and the value (= n) of the bit rate register (scbrr) are calculated, after which the error in the bit rate is calculated. this error is checked to see if it is smaller than 4%. a result greater than or equal to 4% generates a bit rate selection error. the following formula is use to calculate the error. error (%) = [ ] - 1 100 (n + 1) b 64 2 2n-1 p 10 6
section 20 flash memory rev. 3.00 oct. 06, 2008 page 882 of 1080 rej09b0230-0300 when the new bit rate is selectable, the boot program returns an ack code to the host and then makes the register setting to select the new bit rate. the host then sends an ack code at the new bit rate, and the boot program responds to this with another ack code, this time at the new bit rate. acknowledge h'06 ? acknowledge h'06 (1 byte): the ack code sent by the host to acknowledge the new bit rate. response h'06 ? response h'06 (1 byte): the ack code transferred in response to acknowledgement of the new bit rate the sequence of new bit rate selection is shown in figure 20.25. host boot pro g ram new bit rate settin g h'06 (ack) h'06 (ack) at the new bit rate h'06 (ack) at the new bit rate new bit rate settin g wait for one-bit period at the current bit rate settin g settin g the new bit rate figure 20.25 sequence of new bit rate selection
section 20 flash memory rev. 3.00 oct. 06, 2008 page 883 of 1080 rej09b0230-0300 (12) transition to the programming/erasure state in response to the transition to the programming/erasure state command, the boot program transfers the erasing program and runs it to erase any data in the user mat and then the user boot mat. on completion of this erasure, the boot program returns the ack code and enters the programming/erasure state. before sending the programming selection command and data for programming, the host must select the device, clock mode, and new bit rate for the lsi by issuing the device selection command, clock-mode selection command, new-bit-rate selection command, and then initiate the transition to the programming/erasure state by sending the corresponding command to the boot program. command h'40 ? command h'40 (1 byte): transition to programming/erasure state response h'06 ? response h'06 (1 byte): response to the tran sition-to-programming/erasure state command this is returned as ack when erasure of the user boot mat and user mat has succeeded after transfer of the erasure program. error response h'c0 h'51 ? error response h'c0 (1 byte): error response to the transition-to-programming/erasure state command ? error (1 byte): error code h'51: erasure error (erasure did not succeed because of an error.)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 884 of 1080 rej09b0230-0300 ? command error command errors are generated by undefined commands, commands sent in an incorrect order, and the inability to accept a command. for example, sending the clock-mode selection command before device selection or an inquiry command after the transiti on-to-programming/erasure state command generates a command error. error response h'80 h'xx ? error response h'80 (1 byte): command error ? command h'xx (1 byte): received command ? order of commands in the inquiry-and-selection state, commands should be sent in the following order. 1. send the inquiry on supported devices command (h'20) to get the list of supported devices. 2. select a device from the returned device information, and send the device selection command (h'10) to select that device. 3. send the inquiry on clock mode command (h'21) to get the available clock modes. 4. select a clock mode from among the returned clock modes, and send the clock-mode selection command (h'11). 5. after selection of the device and clock mode, send the commands to inquire about frequency multipliers (h'22) and operating frequencies (h'23) to get the information required to select a new bit rate. 6. taking into account the returned information on the frequency multipliers and operating frequencies, send a new-bit-rate selection command (h'3f). 7. after the device and clock mode have been selected, get the information required for programming and erasure of the user boot mat and user mat by sending the commands to inquire about the user boot mat (h'24), user mat (h'25), erasure block (h'26), and programming size (h'27). 8. after making all necessary inquiries and the new bit rate selection, send the transition-to- programming/erasure state command (h'40) to place the boot program in the programming/erasure state.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 885 of 1080 rej09b0230-0300 ? programming/erasure state in this state, the boot program must select the form of programming corresponding to the programming-selection command and then write data in response to 128-byte programming commands, or perform erasure in block units in response to the erasure-selection and block- erasure commands. the programming and erasure commands are listed in table 20.15. table 20.15 programming and erasure commands command command name function h'42 selection of user boot mat programming selects transfer of the program for user boot mat programming. h'43 selection of user mat programming selects transfer of the program for user mat programming. h'50 128-byte programming executes 128-byte programming. h'48 erasure selection selects transfer of the erasure program. h'58 block erasure executes erasure of the specified block. h'52 memory read reads from memory. h'4a sum checking of user boot mat executes sum checking of the user boot mat. h'4b sum checking of user mat executes sum checking of the user mat. h'4c blank checking of user boot mat executes blank checking of the user boot mat. h'4d blank checking of user mat executes blank checking of the user mat. h'4f inquiry on boot program state requests information on the state of boot processing.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 886 of 1080 rej09b0230-0300 ? programming programming is performed by issuing a programming-selection command and the 128-byte programming command. firstly, the host issues the programming-selection command to select the mat to be programmed. two programming-selection commands are provided for the selection of either of the two target areas. 1. selection of user boot mat programming 2. selection of user mat programming next, the host issues a 128-byte programming command. 128 bytes of data for programming by the method selected by the preceding programming selection command are expected to follow the command. to program more than 128 bytes, repeatedly issue 128-byte programming commands. to terminate programming, the host should send another 128-byte programming command with the address h'ffffffff. on completion of programming, the boot program waits for the next programming/erasure selection command. to then program the other mat, start by sending the programming select command. the sequence of programming by programming-selection and 128-byte programming commands is shown in figure 20.26. host boot pro g ram pro g rammin g selection (h'42, h'43) ack 128-byte pro g rammin g (address and data) ack 128-byte pro g rammin g (h'ffffffff) ack transfer the pro g ram that performs pro g rammin g pro g rammin g repeat figure 20.26 sequence of programming
section 20 flash memory rev. 3.00 oct. 06, 2008 page 887 of 1080 rej09b0230-0300 (1) selection of user boot mat programming in response to the command for selecting programming of the user boot mat, the boot program transfers the corresponding flash-writing program, i.e. the program for writing to the user boot mat. command h'42 ? command h'42 (1 byte): selects programming of the user boot mat. response h'06 ? response h'06 (1 byte): response to selection of user boot mat programming this ack code is returned after transfer of the program that performs writing to the user boot mat. error response h'c2 error ? error response h'c2 (1 byte): error response to selection of user boot mat programming ? error (1 byte): error code h'54: error in selection processing (processi ng was not completed because of a transfer error) (2) selection of user mat programming in response to the command for selecting programming of the user mat, the boot program transfers the corresponding flash-writing program, i.e. the program for writing to the user mat. command h'43 ? command h'43 (1 byte): selects programming of the user mat. response h'06 ? response h'06 (1 byte): response to selection of user mat programming this ack code is returned after transfer of the program that performs writing to the user mat.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 888 of 1080 rej09b0230-0300 error response h'c3 error ? error response h'c3 (1 byte): error response to selection of user mat programming ? error (1 byte): error code h'54: error in selection processing (processi ng was not completed because of a transfer error) (3) 128-byte programming in response to the 128-byte programming command, the boot program executes the flash-writing program transferred in response to the command to select programming of the user boot mat or user mat. command h'50 address for programming data ? ? sum ? command h'50 (1 byte): 128-byte programming ? address for programming (4 bytes): address where programming starts this should be the address of a 128-byte boundary. [example] h'00, h01, h'00, h'00: h'00010000 ? programming data (n bytes): data for programming the length of the programming data is the size returned in response to the programming size inquiry command. ? sum (1 byte): checksum response h'06 ? response h'06 (1 byte): response to 128-byte programming the ack code is returned on completion of the requested programming. error response h'd0 error
section 20 flash memory rev. 3.00 oct. 06, 2008 page 889 of 1080 rej09b0230-0300 ? error response h'd0 (1 byte): error response to 128-byte programming ? error (1 byte): error code h'11: sum-check error h'2a: address error (the address is not within the range for the selected mat) h'53: programming error (programming failed because of an error in programming) the specified address should be on a boundary corresponding to the unit of programming (programming size). for example, when programming 128 bytes of data, the lowest byte of the address should be either h'00 or h'80. when less than 128 bytes of data are to be programmed, the host should transmit the data after padding the vacant bytes with h'ff. to terminate programming of a given mat, send a 128-byte programming command with the address field h'ffffffff. this informs the boot program that all data for the selected mat have been sent; the boot program then waits for the next programming/erasure selection command. command h'50 address for programming sum ? command h'50 (1 byte): 128-byte programming ? address for programming (4 bytes): terminating code (h'ff, h'ff, h'ff, h'ff) ? sum (1 byte): checksum response h'06 ? response h'06 (1 byte): response to 128-byte programming this ack code is returned on completion of the requested programming. error response h'd0 error ? error response h'd0 (1 byte): error response to 128-byte programming ? error (1 byte): error code h'11: sum-check error h'53: programming error
section 20 flash memory rev. 3.00 oct. 06, 2008 page 890 of 1080 rej09b0230-0300 ? erasure erasure is performed by issuing the erasure selection command and then one or more block erasure commands. firstly, the host sends the erasure selection command to select erasure; after that, it sends a block erasure command to actually erase a specific block. to erase multiple blocks, send further block erasure commands. to terminate erasure, the host should send a block erasure command with the block number h'ff. after this, the boot program waits for the next programming/erasure selection command. the sequence of erasure by the erasure selection command and block erasure command is shown in figure 20.27. ack erasure (h'ff) erasure selection (h'48) erasure (block number) ack ack erasure transfer the pro g ram that performs erasure boot pro g ram host repeat figure 20.27 sequence of erasure
section 20 flash memory rev. 3.00 oct. 06, 2008 page 891 of 1080 rej09b0230-0300 (1) select erasure in response to the erasure selection command, the boot program transfers the program that performs erasure, i.e. erases data in the user mat. command h'48 ? command h'48 (1 byte): selects erasure. response h'06 ? response h'06 (1 byte): response to selection of erasure this ack code is returned after transfer of the program that performs erasure. error response h'c8 error ? error response h'c8 (1 byte): error response to selection of erasure ? error (1 byte): error code h'54: error in selection processing (processi ng was not completed because of a transfer error.) (2) block erasure in response to the block erasure command, the boot program erases the data in a specified block of the user mat. command h'58 size block number sum ? command h'58 (1 byte): erasure of a block ? size (1 byte): the number of characters in the block number field (fixed at 1) ? block number (1 byte): block number of the block to be erased ? sum (1 byte): checksum response h'06 ? response h'06 (1 byte): response to the block erasure command this ack code is returned when the block has been erased.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 892 of 1080 rej09b0230-0300 error response h'd8 error ? error response h'd8 (1 byte): error response to the block erasure command ? error (1 byte): error code h'11: sum-check error h'29: block number error (the specified block number is incorrect.) h'51: erasure error (an error occurred during erasure.) on receiving the command with h'ff as the bl ock number, the boot program stops erasure processing and waits for the next programming/erasure selection command. command h'58 size block number sum ? command h'58 (1 byte): erasure of a block ? size (1 byte): the number of characters in the block number field (fixed at 1) ? block number (1 byte): h'ff (erasure terminating code) ? sum (1 byte): checksum response h'06 ? response h'06 (1 byte): ack code to indicate response to the request for termination of erasure to perform erasure again after having issued the command with the block number specified as h'ff, execute the process from the selection of erasure. ? memory read in response to the memory read command, the boot program returns the data from the specified address. command h'52 size area first address for reading amount to read sum ? command h'52 (1 byte): memory read ? size (1 byte): the total length of the area, address for reading, and amount to read fields (fixed value of 9)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 893 of 1080 rej09b0230-0300 ? area (1 byte): h'00: user boot mat h'01: user mat an incorrect area specification will produce an address error. ? address where reading starts (4 bytes) ? amount to read (4 bytes): the amount of data to be read ? sum (1 byte): checksum response h'52 amount to read data ? sum ? response h'52 (1 byte): response to the memory read command ? amount to read (4 bytes): the amount to read as specified in the memory read command ? data (n bytes): the specified amount of data read out from the specified address ? sum (1 byte): checksum error response h'd2 error ? error response h'd2 (1 byte): error response to memory read command ? error (1 byte): error code h'11: sum-check error h'2a: address error (the address specified for reading is beyond the range of the mat) h'2b: size error (the specified amount is greater than the size of the mat, the last address for reading as calculated from the specified address for the start of reading and the amount to read is beyond the mat area, or "0" was specified as the amount to read)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 894 of 1080 rej09b0230-0300 ? sum checking of the user boot mat in response to the command for sum checking of the user boot mat, the boot program adds all bytes of data in the user boot mat and returns the result. command h'4a ? command h'4a (1 byte): sum checking of the user boot mat response h'5a size checksum for the mat sum ? response h'5a (1 byte): response to sum checking of the user boot mat ? size (1 byte): the number of characters in the checksum for the mat (fixed at 4) ? checksum for the mat (4 bytes): result of ch ecksum calculation for the user boot mat: the total of all data in the mat, in byte units. ? sum (1 byte): checksum (for the transmitted data) ? sum checking of the user mat in response to the command for sum checking of the user mat, the boot program adds all bytes of data in the user mat and returns the result. command h'4b ? command h'4b (1 byte): sum checking of the user mat response h'5b size checksum for the mat sum ? response h'5b (1 byte): response to sum checking of the user mat ? size (1 byte): the number of characters in the checksum for the mat (fixed at 4) ? checksum for the mat (4 bytes): result of checksum calculation for the user mat: the total of all data in the mat, in byte units. ? sum (1 byte): checksum (for the transmitted data)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 895 of 1080 rej09b0230-0300 ? blank checking of the user boot mat in response to the command for blank checking of the user boot mat, the boot program checks to see if the whole of the user boot mat is bl ank; the value returned indicates the result. command h'4c ? command h'4c (1 byte): blank checking of the user boot mat response h'06 ? response h'06 (1 byte): response to blank checking of the user boot mat this ack code is returned when the whole area is blank (all bytes are h'ff). error response h'cc h'52 ? error response h'cc (1 byte): error response to blank checking of the user boot mat ? error code h'52 (1 byte): non-erased error ? blank checking of the user mat in response to the command for blank checking of the user mat, the boot program checks to see if the whole of the user mat is blank; the value returned indicates the result. command h'4d ? command h'4d (1 byte): blank checking of the user boot mat response h'06 ? response h'06 (1 byte): response to blank checking of the user mat the ack code is returned when the w hole area is blank (all bytes are h'ff). error response h'cd h'52 ? error response h'cd (1 byte): error response to blank checking of the user mat ? error code h'52 (1 byte): non-erased error
section 20 flash memory rev. 3.00 oct. 06, 2008 page 896 of 1080 rej09b0230-0300 ? inquiry on boot program state in response to the command for inquiry on the state of the boot program, the boot program returns an indicator of its current state and error information. this inquiry can be made in the inquiry-and- selection state or the pr ogramming/erasure state. command h'4f ? command h'4f (1 byte): inquiry on boot program state response h'5f size status error sum ? response h'5f (1 byte): response to the inquiry regarding boot-program state ? size (1 byte): the number of characters in status and error (fixed at 2) ? status (1 byte): state of the standard boot program see table 20.16. ? error (1 byte): error state (indicates whether the program is in normal operation or an error has occurred) error = 0: normal error 0: error see table 20.17. ? sum (1 byte): checksum table 20.16 status codes code description h'11 waiting for device selection h'12 waiting for clock-mode selection h'13 waiting for bit-rate selection h'1f waiting for transition to programming/erasure status (bit-rate selection complete) h'31 erasing the user mat or user boot mat h'3f waiting for programming/erasure selection (erasure complete) h'4f waiting to receive data for programming (programming complete) h'5f waiting for erasure block specification (erasure complete)
section 20 flash memory rev. 3.00 oct. 06, 2008 page 897 of 1080 rej09b0230-0300 table 20.17 error codes code description h'00 no error h'11 sum check error h'21 non-matching device code error h'22 non-matching clock mode error h'24 bit-rate selection failure h'25 input frequency error h'26 frequency multiplier error h'27 operating frequency error h'29 block number error h'2a address error h'2b data length error (size error) h'51 erasure error h'52 non-erased error h'53 programming error h'54 selection processing error h'80 command error h'ff bit-rate matching acknowledge error 20.9.2 areas for storage of the procedural program and data for programming in the descriptions in the previous section, storable areas for the programming/erasing procedure programs and program data are assumed to be in on-chip ram. however, the procedure programs and data can be stored in and executed from other areas (e.g. external address space) as long as the following conditions are satisfied. 1. the on-chip programming/erasing program is downloaded from the address set by ftdar in on-chip ram, therefore, this area is not available for use. 2. the on-chip programming/erasing program will use 128 bytes or more as a stack. make sure this area is reserved. 3. since download by setting the sco bit to 1 will cause the mats to be switched, it should be executed in on-chip ram. 4. the flash memory is accessible until the start of programming or erasing, that is, until the result of downloading has been decided. when in a mode in which the external address space
section 20 flash memory rev. 3.00 oct. 06, 2008 page 898 of 1080 rej09b0230-0300 is not accessible, such as single-chip mode, th e required procedure programs, interrupt vector table, interrupt processing routine, and user br anch program should be transferred to on-chip ram before programming/erasing of the flash memory starts. 5. the flash memory is not accessible during programming/erasing operations. therefore, the programming/erasing program must be downloaded to on-chip ram in advance. areas for executing each procedure program for initiating programming/erasing, the user program at the user branch destination for programming/erasing, the interrupt vector table, and the interrupt processing routine must be located in on-chip memory other than flash memory or the external address space. 6. after programming/erasing, access to flash memory is inhibited until fkey is cleared. a reset state ( res = 0) for more than at least 100 s must be taken when the lsi mode is changed to reset on completion of a programming/erasing operation. transitions to the reset state or hardware standby mode during programming/erasing are inhibited. when the reset signal is accidentally input to the lsi, a longer period in the reset state than usual (100 s) is needed before the reset signal is released. 7. switching of the mats by fmats is needed for programming/erasing of the user mat in user boot mode. the program which switches the mats should be executed from the on-chip ram. for details, see section 20.8.1, switching between user mat and user boot mat. please make sure you know which mat is selected when switching the mats. 8. when the program data storage area indicated by the fmpdr parameter in the programming processing is within the flash memory area, an error will occur. therefore, temporarily transfer the program data to on-chip ram to change the address set in fmpdr to an address other than flash memory. based on these conditions, tables 20.18 and 20.19 show the areas in which the program data can be stored and executed according to the operation type and mode. table 20.18 executable mat initiated mode operation user program mode user boot mode * programming table 20.19 (1) table 20.19 (3) erasing table 20.19 (2) table 20.19 (4) note: * programming/erasing is possible to user mats.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 899 of 1080 rej09b0230-0300 table 20.19 (1) usable area for programming in user program mode storable/executable area selected mat item on- chip ram user mat external space user mat embedded program storage mat program data storage area x * ? ? selecting on-chip program to be downloaded writing h'a5 to key register writing 1 to sco in fccs (download) x x key register clearing deciding download result download error processing setting initialization parameters initialization x x deciding initialization result initialization error processing pro- gram- ming proce- dure interrupt processing routine x writing h'5a to key register setting programming parameters x programming x x deciding programming result x programming error processing x key register clearing x note: * if the data has been transferred to on-chip ram in advance, this area can be used.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 900 of 1080 rej09b0230-0300 table 20.19 (2) usable area for erasure in user program mode storable/executable area selected mat item on- chip ram user mat external space user mat embedded program storage mat selecting on-chip program to be downloaded writing h'a5 to key register writing 1 to sco in fccs (download) x x key register clearing deciding download result download error processing setting initialization parameters initialization x x deciding initialization result initialization error processing interrupt processing routine x erasing proce- dure writing h'5a to key register setting erasure parameters x erasure x x deciding erasure result x erasing error processing x key register clearing x
section 20 flash memory rev. 3.00 oct. 06, 2008 page 901 of 1080 rej09b0230-0300 table 20.19 (3) usable area for programming in user boot mode storable/executable area selected mat item on- chip ram user boot mat external space user mat user boot mat embedded program storage area program data storage area x * 1 ? ? ? selecting on-chip program to be downloaded writing h'a5 to key register writing 1 to sco in fccs (download) x x key register clearing deciding download result download error processing pro- gram- ming proce- dure setting initialization parameters initialization x x deciding initialization result initialization error processing interrupt processing routine x switching mats by fmats x x writing h'5a to key register x
section 20 flash memory rev. 3.00 oct. 06, 2008 page 902 of 1080 rej09b0230-0300 storable/executable area selected mat item on- chip ram user boot mat external space user mat user boot mat embedded program storage area setting programming parameters x programming x x deciding programming result x programming error processing x * 2 pro- gram- ming proce- dure key register clearing x switching mats by fmats x x notes: 1. if the data has been transferred to on-chip ram in advance, this area can be used. 2. if the mats have been switched by fmats in on-chip ram, this mat can be used.
section 20 flash memory rev. 3.00 oct. 06, 2008 page 903 of 1080 rej09b0230-0300 table 20.19 (4) usable area for erasure in user boot mode storable/executable area selected mat item on- chip ram user boot mat external space user mat user boot mat embedded program storage area selecting on-chip program to be downloaded writing h'a5 to key register writing 1 to sco in fccs (download) x x key register clearing deciding download result download error processing setting initialization parameters initialization x x erasing proce- dure deciding initialization result initialization error processing interrupt processing routine x switching mats by fmats x x writing h'5a to key register x setting erasure parameters x
section 20 flash memory rev. 3.00 oct. 06, 2008 page 904 of 1080 rej09b0230-0300 storable/executable area selected mat item on- chip ram user boot mat external space user mat user boot mat embedded program storage area erasure x x deciding erasure result x erasing error processing x * erasing proce- dure key register clearing x switching mats by fmats x x note: * if the mats have been switched by fmats in on-chip ram, this mat can be used. 20.10 programmer mode in programmer mode, a prom programmer can be used to perform programming/erasing via a socket adapter, just as for a discrete flash memory. use a prom programmer that supports the renesas 512-kbyte/384-kbyte/256-kbyte flash memory on-chip mcu device type (f- ztatxxxx).
section 21 ram rev. 3.00 oct. 06, 2008 page 905 of 1080 rej09b0230-0300 section 21 ram this lsi has an on-chip high-speed static ram. the on-chip ram is connected to the cpu by a 32-bit data bus (l bus), and to the data transfer controller (dtc) by a 32-bit data bus (i bus), enabling 8, 16, or 32-bit width acce ss to data in the on-chip ram. the on-chip ram is allocated to the addresses shown in figures 21.1 and 21.2, and the on-chip ram is divided into page 0 and page 1 based on the addresses. the on-chip ram can be accessed from the cpu (via the l bus) and the dtc (via th e i bus). when different buses request to access the same page simultaneously, the priority becomes i bus (dtc) > l bus (cpu). since such kind of conflict degrades the ram access performance, software should be created so as to avoid conflicts. for example, conflict does not occur wh en the buses access different pages. an access from the l bus (cpu) is a 1-cycle access as long as page conflict does not occur. the number of bus cycles in accesses from the i bus (dtc) diff er depending on the ratio between the internal clock (i ) and bus clock (b ), and the operating state of the dtc. the contents of the on-chip ram are retained in sleep mode or software standby mode, and at a power-on reset or manual reset. however, the contents of the on-chip ram are not retained in deep software standby mode or hardware standby mode. the on-chip ram can be enabled or disabled by means of the rame bit in the ram control register (ramcr). for details on the ram contro l register (ramcr), refer to section 22.3.7, ram control register (ramcr). h'ffffbfff h'ffffa000 h'ffff9fff h'ffff9000 pa g e 1 8 kbytes pa g e 0 4 kbytes (12 kbytes) figure 21.1 12-kbyte on-chip ram addresses
section 21 ram rev. 3.00 oct. 06, 2008 page 906 of 1080 rej09b0230-0300 h'ffffbfff h'ffffa000 h'ffff9fff h'ffff8000 pa g e 1 8 kbytes pa g e 0 8 kbytes (16 kbytes) figure 21.2 16-kbyte on-chip ram addresses 21.1 usage notes 21.1.1 module standby mode setting ram can be enabled/disabled by the standby control register. the initial value enables ram operation. ram access is disabled by setting the module standby mode. for details, see section 22, power-down modes. 21.1.2 address error when an address error in write access to the on-chip ram occurs , the contents of the on-chip ram may be corrupted. 21.1.3 initial values in ram after power has been supplied, initial values in ram remain undefined until ram is written.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 907 of 1080 rej09b0230-0300 section 22 power-down modes this lsi supports the following power-down modes: sleep mode, software standby mode, deep software standby mode, hardware st andby mode, and module standby mode. 22.1 features ? supports sleep mode, software standby mode, module standby mode, deep software standby mode, and hardware standby mode. 22.1.1 types of power-down modes this lsi has the following power-down modes. ? sleep mode ? software standby mode ? deep software standby mode ? module standby mode ? hardware standby mode table 22.1 shows the methods to make a transition from the program execution state, as well as the cpu and peripheral module states in each m ode and the procedures for canceling each mode.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 908 of 1080 rej09b0230-0300 table 22.1 states of power-down modes state mode transition method cpg cpu cpu register on-chip memory on-chip peripheral modules canceling procedure sleep execute sleep instruction with stby bit in stbcr1 cleared to 0. runs halts held runs run ? reset software standby execute sleep instruction with stby bit in stbcr1 and stbymd bit in stbcr6 set to 1. halts halts held halts (contents retained) halt ? interrupt by nmi or irq ? power-on reset by the res pin deep software standby execute sleep instruction with stby bit in stbcr1 set to 1 and stbymd bit in stbcr6 cleared to 0. halts halts undefined halts (contents undefined) halt ? power-on reset by the res pin module standby set mstp bits in stbcr2 to stbcr5 to 1. runs runs held specified module halts (contents retained) specified module halts ? clear mstp bit to 0 ? power-on reset (for modules whose mstp bit has an initial value of 0) hardware standby drive the hstby pin low halts halts undefined halts (contents undefined) halt ? power-on reset by the res pin note: for details on the states of on-chip peripheral module registers in each mode, refer to section 24.3, register states in each operating mode. for details on the pin states in each mode, refer to appendix a, pin states.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 909 of 1080 rej09b0230-0300 22.2 input/output pins table 22.2 lists the pins used for the power-down modes. table 22.2 pin configuration pin name symbol i/o description power-on reset res input power-on reset input signal. power-on reset by low level. manual reset mres input manual reset input signal. manual reset by low level. hardware standby hstby input hardware standby input signal. hardware standby by low level. pulled-up inside the lsi when there is no input.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 910 of 1080 rej09b0230-0300 22.3 register descriptions there are following registers used for the power-down modes. for details on the addresses of these registers and the states of these registers in each processing state, see section 24, list of registers. table 22.3 register configuration register name abbrevia- tion r/w initial value address access size standby control register 1 stbcr1 r/w h'00 h'ffffe802 8 standby control register 2 stbcr2 r/w h'38 h'ffffe804 8 standby control register 3 stbcr3 r/w h'ff h'ffffe806 8 standby control register 4 stbcr4 r/w h'ff h'ffffe808 8 standby control register 5 stbcr5 r/w h'03 h'ffffe80a 8 standby control register 6 stbcr6 r/w h'00 h'ffffe80c 8 ram control register ramcr r/w h'10 h'ffffe880 8 22.3.1 standby control register 1 (stbcr1) stbcr1 is an 8-bit readable/wr itable register that specifies th e state of the power-down mode. bit: initial value: r/w: 7654321 0 00000000 r/wrrrrrrr stby------- bit bit name initial value r/w description 7 stby 0 r/w standby specifies transition to software standby mode. 0: executing sleep instruction makes this lsi sleep mode 1: executing sleep instruction makes this lsi software standby mode or deep software standby mode
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 911 of 1080 rej09b0230-0300 bit bit name initial value r/w description 6 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 22.3.2 standby control register 2 (stbcr2) stbcr2 is an 8-bit readable/writable register that controls the operation of modules in power- down mode. bit: initial value: r/w: 7654321 0 00111000 r/w r/w r r/w r r r r mstp 7 mstp 6 - mstp 4 ---- bit bit name initial value r/w description 7 mstp7 0 r/w module stop bit 7 when this bit is set to 1, the supply of the clock to the ram is halted. 0: ram operates 1: clock supply to ram halted 6 mstp6 0 r/w module stop bit 6 when this bit is set to 1, the supply of the clock to the rom is halted. 0: rom operates 1: clock supply to rom halted 5 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 4 mstp4 1 r/w module stop bit 4 when this bit is set to 1, the supply of the clock to the dtc is halted. 0: dtc operates 1: clock supply to dtc halted
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 912 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 2 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 22.3.3 standby control register 3 (stbcr3) stbcr3 is an 8-bit readable/writable register that controls the operation of modules in power- down mode. bit: initial value: r/w: 7654321 0 11111111 r r r/w r/w r/w r/w r/w r/w -- mstp 13 mstp 12 mstp 11 mstp 10 mstp 9 * mstp 8 bit bit name initial value r/w description 7, 6 ? all 1 r reserved these bits are always read as 1. the write value should always be 1. 5 mstp13 1 r/w module stop bit 13 when this bit is set to 1, the supply of the clock to the sci_2 is halted. 0: sci_2 operates 1: clock supply to sci_2 halted 4 mstp12 1 r/w module stop bit 12 when this bit is set to 1, the supply of the clock to the sci_1 is halted. 0: sci_1 operates 1: clock supply to sci_1 halted
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 913 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 mstp11 1 r/w module stop bit 11 when this bit is set to 1, the supply of the clock to the sci_0 is halted. 0: sci_0 operates 1: clock supply to sci_0 halted 2 mstp10 1 r/w module stop bit 10 when this bit is set to 1, the supply of the clock to the synchronous serial communication unit is halted. 0: synchronous serial communication unit operates 1: clock supply to synchronous serial communication unit halted 1 mstp9 * 1 r module stop bit 9 (available only in the sh7142) when this bit is set to 1, the clock supply of the clock to the rcan-et_1 is halted. 0: rcan-et_1 operates 1: clock supply to rcan-et_1 halted 0 mstp8 1 r/w module stop bit 8 when this bit is set to 1, the clock supply of the clock to the rcan-et_0 is halted. 0: rcan-et_0 operates 1: clock supply to rcan-et_0 halted note: * this bit is reserved in the sh7147. this bit is always read as 1. the write value should always be 1.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 914 of 1080 rej09b0230-0300 22.3.4 standby control register 4 (stbcr4) stbcr4 is an 8-bit readable/writable register that controls the operation of modules in power- down mode. bit: initial value: r/w: 7654321 0 11111111 r/w r/w r/w r/w r/w r r r mstp 23 mstp 22 mstp 21 mstp 20 mstp 19 --- bit bit name initial value r/w description 7 mstp23 1 r/w module stop bit 23 when this bit is set to 1, the supply of the clock to the mtu2s is halted. 0: mtu2s operates 1: clock supply to mtu2s halted 6 mstp22 1 r/w module stop bit 22 when this bit is set to 1, the supply of the clock to the mtu2 is halted. 0: mtu2 operates 1: clock supply to mtu2 halted 5 mstp21 1 r/w module stop bit 21 when this bit is set to 1, the supply of the clock to the cmt is halted. 0: cmt operates 1: clock supply to cmt halted 4 mstp20 1 r/w module stop bit 20 when this bit is set to 1, the supply of the clock to the a/d_1 is halted. 0: a/d_1 operates 1: clock supply to a/d_1 halted
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 915 of 1080 rej09b0230-0300 bit bit name initial value r/w description 3 mstp19 1 r/w module stop bit 19 when this bit is set to 1, the supply of the clock to the a/d_0 is halted. 0: a/d_0 operates 1: clock supply to a/d_0 halted 2 to 0 ? all 1 r reserved these bits are always read as 1. the write value should always be 1. 22.3.5 standby control register 5 (stbcr5) stbcr5 is an 8-bit readable/writable register that controls the operation of modules in power- down mode. bit: initial value: r/w: 7654321 0 00000011 rrrrrrr/wr/w -- -- -- mstp 25 mstp 24 bit bit name initial value r/w description 7 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 mstp25 1 r/w module stop bit 25 when this bit is set to 1, the supply of the clock to the aud is halted. 0: aud operates 1: clock supply to aud halted 0 mstp24 1 r/w module stop bit 24 when this bit is set to 1, the supply of the clock to the ubc is halted. 0: ubc operates 1: clock supply to ubc halted
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 916 of 1080 rej09b0230-0300 22.3.6 standby control register 6 (stbcr6) stbcr6 is an 8-bit readable/writable register th at specifies the state of the power-down modes. bit: initial value: r/w: 7654321 0 00000000 r/w r/w r r r r r/w r -- hiz - aud srst - stby md - bit bit name initial value r/w description 7 audsrst 0 r/w aud software reset this bit controls the aud reset by software. when 0 is written to audsrst, the aud module shifts to the power-on reset state. 0: shifts to the aud reset state 1: clears the aud reset when setting this bit to 1, the mstp25 bit in stbcr5 should be 0. 6 hiz 0 r/w port high-impedance in software standby mode, this bit selects whether the pin state is retained or changed to high-impedance. 0: in software standby mode, the pin state is retained 1: in software standby mode, the pin state is changed to high-impedance 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 stbymd 0 r/w software standby mode select this bit selects a transition to software standby mode or deep software standby mode by executing the sleep instruction when the stby bit is 1 in stbcr1. 0: transition to deep software standby mode 1: transition to software standby mode 0 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 917 of 1080 rej09b0230-0300 22.3.7 ram control register (ramcr) ramcr is an 8-bit readable/wr itable register that enables/di sables the access to the on-chip ram. bit: initial value: r/w: 7654321 0 00010000 rrrr/wrrrr rame - -- - --- bit bit name initial value r/w description 7 to 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 4 rame 1 r/w ram enable this bit enables/disables the on-chip ram. 0: on-chip ram disabled 1: on-chip ram enabled when this bit is cleared to 0, the access to the on-chip ram is disabled. in this case, an undefined value is returned when reading or fetching the data or instruction from the on-chip ram, and writing to the on- chip ram is ignored. when rame is cleared to 0 to disable the on-chip ram, an instruction to access the on-chip ram should not be set next to the instruction to write ramcr. if such an instruction is set, normal access is not guaranteed. when rame is set to 1 to enable the on-chip ram, an instruction to read ramcr should be set next to the instruction to write to ramcr. if an instruction to access the on-chip ram is set next to the instruction to write to ramcr, normal access is not guaranteed. 3 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 918 of 1080 rej09b0230-0300 22.4 sleep mode 22.4.1 transition to sleep mode executing the sleep instruction when the stby bit in stbcr1 is 0 causes a transition from the program execution state to sleep mode. however, sleep mode cannot be entered when the bus is released (low-level input to breq pin). although the cpu halts immediately after executing the sleep instruction, the contents of its internal registers remain unchanged. the on-chip peripheral modules continue to operate. 22.4.2 canceling sleep mode sleep mode is canceled by a reset. do not cancel sleep mode with an interrupt. (1) canceling with reset sleep mode is canceled by a power-on reset with the res pin, a manual reset with the mres pin, or an internal power-on/manual reset by the wdt.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 919 of 1080 rej09b0230-0300 22.5 software standby mode 22.5.1 transition to software standby mode this lsi switches from a program execution state to software standby mode by executing the sleep instruction when the stby bit in stbcr1 and the stbymd bit in stbcr6 are set to 1. however, software standby mode cannot be entered when the bus is released (low-level input to breq pin). execute the sleep instruction after halting the dtc. in software standby mode, not only the cpu but also the clock and on-chip peripheral modules halt. the contents of the cpu registers and the data of the on-chip ram remain unchanged. some registers of on-chip peripheral modules are, however, initialized. for details on the states of on- chip peripheral module registers in software standby mode, refer to section 24.3, register states in each operating mode. for details on the pin states in software standby mode, refer to appendix a, pin states. the procedure for switching to software standby mode is as follows: 1. clear the tme bit in the timer control register (wtcsr) of the wdt to 0 to stop the wdt. 2. set the timer counter (wtcnt) of the wdt to 0 and bits cks2 to cks0 in wtcsr to appropriate values to secure the specified oscillation settling time. 3. if the dtc is operating, stop its operation. 4. if the bus is released (low-level input to breq pin), acquire the bus mastership (high-level input to breq pin). 5. after setting the stby bit in stbcr1 and th e stbymd bit in stbcr6 to 1, execute the sleep instruction. 6. software standby mode is entered and the clocks within this lsi are halted.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 920 of 1080 rej09b0230-0300 22.5.2 canceling software standby mode software standby mode is canceled by interrupts (nmi, irq) or a reset. (1) canceling with interrupt the wdt can be used for hot starts. when an nmi or irq interrupt (edge detection) is detected, the clock will be supplied to the entire lsi and so ftware standby mode will be canceled after the time set in the timer control/status register of the wdt has elapsed. interrupt exception handling is then executed. when the priority level of an irq interrupt is lower than the interrupt mask level set in the status register (sr) of the cpu, an interrupt request is not accepted preventing software standby mode from being canceled. when falling-edge detection is selected for the nmi pin, drive the nmi pin high before making a transition to software standby mode. when rising-edge detection is selected for the nmi pin, drive the nmi pin low before making a transition to software standby mode. similarly, when falling-edge detection is selected for the irq pin, drive the irq pin high before making a transition to software standby mode. when rising-edge detection is selected for the irq pin, drive the irq pin low before making a transition to software standby mode. (2) canceling with power-on reset software standby mode is canceled by a power-on reset with the res pin. keep the res pin low until the clock oscillation settles.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 921 of 1080 rej09b0230-0300 22.6 deep software standby mode 22.6.1 transition to deep software standby mode this lsi shifts from a program execution state to deep software standby mode by executing the sleep instruction when the stby bit in stbcr1 is 1 and the stbymd bit in stbcr6 is 0. however, deep software standby mode cannot be entered when the bus is released (low-level input to breq pin). execute the sleep instruction after halting the dtc. in deep software standby mode, not only the cpu but also the clock and on-chip peripheral modules halt. furthermore, the internal power supply of this lsi is turned off. the contents of the cpu registers and the data of the on-chip ram become undefined. the registers of on-chip peripheral modules are initia lized. for details on the pin states in deep software standby mode, refer to appendix a, pin states. the procedure for a transition to deep software standby mode is as follows: 1. clear the tme bit in the timer control register (wtcsr) of the wdt to 0 to stop the wdt. 2. if the dtc is operating, stop its operation. 3. if the bus is released (low-level input to breq pin), acquire the bus mastership (high-level input to breq pin). 4. after setting the stby bit in stbcr1 to 1 and clearing the stbymd bit in stbcr6 to 0, execute the sleep instruction. 5. deep software standby mode is entered, the clocks within this lsi are halted, and the internal power supply of this lsi is turned off. 22.6.2 canceling deep software standby mode deep software standby mode is canceled by a power-on reset with the res pin. keep the res pin low until the clock oscillation settles.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 922 of 1080 rej09b0230-0300 22.7 module standby mode 22.7.1 transition to module standby mode setting the mstp bits in the standby control registers (stbcr2 to stbcr5) to 1 halts the supply of clocks to the corresponding on-chip peripheral modules. this function can be used to reduce the power consumption in normal mode. do not access registers of an on -chip peripheral module which has been set to enter module standby mode. for details on the states of on-chip peripheral module registers in module standby mode, refer to section 24.3, register states in each operating mode. 22.7.2 canceling module standby function the module standby function can be canceled by clearing the mstp bits in stbcr2 to stbcr5 to 0. the module standby function can be canceled by a power-on reset for modules whose mstp bit has an initial value of 0.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 923 of 1080 rej09b0230-0300 22.8 hardware standby mode 22.8.1 transition to hardware standby mode when the hstby pin is driven low, a transition is made to hardware standby mode. in hardware standby mode, not only the cpu but also clocks and peripheral modules stop operation, and internal power supply of this lsi is lost. contents of cpu registers and data in the on-chip ram become undefined. on-chip peripher al module registers are initialized. transition to hardware standby mode is performed asynchronously regardless of the current state of this lsi since the transition is made by the external pin input. for pin states in hardware standby mode, see appendix a, pin states. do not change the state of the mode pins (md1 and md0) while the cpu is in hardware standby mode. 22.8.2 clearing hardware standby mode hardware standby mode is cleared by means of the hstby pin and the res pin. when the hstby pin is driven high while the res pin is low, the clock oscillation is started. ensure that the res pin is held low until the clock oscillation stabilizes. when the res pin is then driven high, a transition is made to the program execution state via the power-on reset exception handling state. 22.8.3 hardware standby mode timing figure 22.1 shows a transition-timing example to hardware standby mode. in this example, the hstby pin is driven low, then the transition to hardware standby mode is made. hardware standby mode is cleared when the hstby pin is driven high and then the res pin is driven high after the elapse of the oscillation stabilization time of the clock pulse.
section 22 power-down modes rev. 3.00 oct. 06, 2008 page 924 of 1080 rej09b0230-0300 oscillation stabilization time reset exception handlin g oscillator res hstby figure 22.1 transition timing to hardware standby mode 22.9 usage note 22.9.1 current consumption while waiting fo r oscillation to be stabilized the current consumption while waiting for oscillation to be stabilized is higher than that while oscillation is stabilized. 22.9.2 executing the sleep instruction apply either of the following m easures before executing the sleep instruction to initiate the transition to sleep mode or software standby mode. measure a: stop the operation of the dtc and the generation of interrupts from on-chip peripheral modules, irq interrupts, and the nmi interrupt before executing the sleep instruction. measure b: change the value in frqcr to the initial value, h'36db, and then dummy-read frqcr twice before executin g the sleep instruction.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 925 of 1080 rej09b0230-0300 section 23 advanced user debugger (aud) the aud offers functions that support user program debugging with the lsi mounted and operated in actual performance. use of the aud simplifies the construction of a simple emulator, with functions such as acquisition of branch trace data and monitoring/tuning of on-chip ram data. 23.1 features ? eight input/output pins the aud can be used in two modes by switching audmd. ? branch trace mode ? ram monitor mode (1) branch trace mode ? branch trace function: selectable between trace for both branch destination and source or either of branch destination and source ? window data trace function: support s two channels for window a and window b. functions to trace memory access address and its data generated within the window. ? supports 8-, 16-, and 32-bit data lengths ? buses subject to trace: l bus and i bus ? a function to output address data in minimum bit number that are comparable to the different parts of addresses ? fifo with eight levels ? full trace function: a function to output all trace data while halting the cpu in case the trace data is too large to fully output ? real-time trace function: a function to output a range of trace data without stalling the cpu ? aud operation frequency: supports cpu core cloc k ratios of 1, 1/2, 1/4, and 1/8 with a maximum operating frequency of 20 mhz (2) ram monitor mode ? functions to read/write modules connected to internal/external buses ? outputs data corresponding to an addr ess that is extern ally written to audata ? transmits data to the address in audata to which address and data are written
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 926 of 1080 rej09b0230-0300 set the frequency of audck clock to satisfy the fo llowing conditions: lower than or equal to both 10 mhz and p 1/4. before utilizing the aud, clear the aud software reset bit (audsrst) in the standby control register 6 (stbcr6) to 0. for details on the audsrst bit, see section 22.3.6, standby control register 6 (stbcr6). figure 23.1 shows the aud block diagram. pc output circuit fifo l bus i bus p bus on-chip memory on-chip peripheral module address buffer data buffer mode control audmd audrst audck audsync audata3 to au data 0 figure 23.1 block diagram of aud
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 927 of 1080 rej09b0230-0300 23.2 input/output pins table 23.1 pin configuration function pin name symbol branch trace mode ram monitor mode aud reset audrst aud reset input aud reset input aud sync signal audsync data start position identification signal output data start position identification signal input aud clock audck sync clock output external clock input aud mode audmd mode select input (l) mode select input (h) aud data audata3 to audata0 branch destination/source address output monitor address input and data input/output 23.2.1 description of common pins table 23.2 pins used in common pin description audmd the mode is selected by changing the input level at this pin. low: branch trace mode high: ram monitor mode the input at this pin should be changed when audrst is low. audrst the aud's internal buffers and logic are initialized by inputting a low level to this pin. when this signal goes low, the aud enters the reset state and the aud's internal buffers and logic are reset. when audrst goes high again after the audmd level settles, the aud starts operating in the selected mode.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 928 of 1080 rej09b0230-0300 23.2.2 description of pins in branch trace mode table 23.3 description of pins in branch trace mode pin description audck aud operating frequency this pin outputs the operating frequency for a cpu core clock ratio of 1, 1/2, 1/4, or 1/8. this is the clock for audata synchronization. note that the available frequency is up to 20 mhz. audsync this pin indicates whether output from audata is valid. high: valid data is not being output low: valid data is being output audata3 to audata0 the following data is output in time-sharing mode. ? aud bus command ? branch destination/source address 23.2.3 description of pins in ram monitor mode table 23.4 description of pins in ram monitor mode pin description audck the external clock input pin. input the clock to be used for debugging to this pin. the input frequency must be lower than or equal to 10 mhz and not exceed 1/4 of p . audsync do not assert this pin until a command is input to audata externally and the necessary data can be prepared. for details, see the protocol description in the following. audata3 to audata0 when a command is input externally, data is output after transmitting ready. output starts when audsync is negated. for details, see the protocol description in the following.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 929 of 1080 rej09b0230-0300 23.3 branch trace mode 23.3.1 register descriptions table 23.5 register configuration register name abbreviation r/w initial value address access size aud control register aucsr r/w h'00000000 h'fffff400 32 aud window a start address register auwasr r/w undefined h'fffff404 32 aud window a end address register auwaer r/w undefined h'fffff408 32 aud window b start address register auwbsr r/w undefined h'fffff40c 32 aud window b end address register auwber r/w undefined h'fffff410 32 aud extended control register auecsr r/w h'00000001 h'fffff414 32 23.3.2 aud control register (aucsr) aucsr is a 32-bit readable/writable register. auc sr is initialized by a power-on reset, manual reset, audrst , aud software reset, and hardware standby mode. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 r/w r/w r r r/w r/w r/w r/w r/w r/w r/w r/w r r r/w r/w 0000000000000000 rrrrrrrrrrrrrrrr clk[1:0] - - bre oc[1:0] br wa[1:0] wb[1:0] tm en -- ----------------
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 930 of 1080 rej09b0230-0300 bit bit name initial value r/w description 31 to 16 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 15, 14 clk[1:0] 00 r/w aud clock select sets cpu clock ratio for aud internal operation clock. 00: 1/8 01: 1/4 10: 1/2 11: 1/1 note: be sure to change the clk bit while the en bit in aucsr is 0 13, 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 8 bre br 0 0 r/w r/w branch trace function aud traces branch destinat ion or source address by settings of these bits. 00: disables branch trace 01: enables branch trace. outputs both destination and source addresses. 10: enables branch trace. outputs source address only. 11: enables branch trace. outputs destination address only. the setting of this register is enabled at the output of a trace executed after setting. the output format after setting is not reflected in the branch trace data downloaded in fifo before setting.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 931 of 1080 rej09b0230-0300 bit bit name initial value r/w description 10, 9 oc[1:0] 00 r/w output counter mode when trace data is output by a branch trace, only the lower bits corresponding to an address change are usually output. however, the entire 32-bit data is periodically output and oc specifies this period. when the oc bits in aucsr are b'11, the changed part of an address is always output as audata trace address output, except for the first cycle after a reset. when the oc bits in aucsr are b'00, a 32-bit address is output every time128 trace data are output. 00: an entire address is output every time128 trace data are output. 01: reserved 10: reserved 11: always outputs the lower part of a changed address 7, 6 wa[1:0] 00 r/w window a data trace function setting these bits enables aud to trace memory access in the area designated by window a. read access, write access, or both can be designated as tracing conditions. we also designates whether the i bus or the l bus should be traced. for details, see section 23.3.7, aud extended control register (auecsr). 00: disables window a data trace function 01: traces only write access 10: traces only read access 11: traces both read and write accesses
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 932 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5, 4 wb[1:0] 00 r/w window b data trace function setting these bits enables aud to trace memory access in the area designated by window b. read access, write access, or both can be designated as tracing conditions. we also designates whether the i bus or the l bus should be traced. for details, see section 23.3.7, aud extended control register (auecsr). 00: disables window b data trace function 01: traces only write access 10: traces only read access 11: traces both read and write accesses 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 tm 0 r/w trace mode designates cpu operation when the fifo buffer for storing various trace data in aud becomes full. 0: full trace mode (outputs all generated trace). 1: real-time trace mode (outputs trace data in real- time without stopping cpu). 0 en 0 r/w aud enable setting this bit enables aud to select the trace function designated by the bits bre, br, wa0, wa1, wb0, and wb1. when this bit is 0, the tracing designated by bre, br, wa0, wa1, wb0, and wb1 is not executed. 0: disables aud trace function 1: enables aud trace function
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 933 of 1080 rej09b0230-0300 23.3.3 aud window a start address register (auwasr) auwasr is a 32-bit readable/writable register. auwasr designates the start address of window a to be traced. the end address is designated by the aud window a end address register (auwber). window a is defined as the area that satisfies auwasr window a auwaer. auwasr is initialized by a power-on reset, manual reset, audrst , aud software reset, and hardware standby mode. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 bit: initial value: r/w 1514131211109876543210 bit: initial value: r/w: 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 23.3.4 aud window a end address register (auwaer) auwaer is a 32-bit readable/writable register. auwasr designates the window a area together with auwasr. auwaer is initialized by a power-on reset, manual reset, audrst , aud software reset, and hardware standby mode. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 bit: initial value: r/w: 1514131211109876543210 bit: initial value: r/w: 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 934 of 1080 rej09b0230-0300 23.3.5 aud window b start address register (auwbsr) auwbsr is a 32-bit readable/writable register. auwbsr designates the start address of window b to be traced. the end address is designated by the aud window b end address register (auwber). window b is defined as the area that satisfies auwbsr window b auwber. auwbsr is initialized by a power-on reset, manual reset, audrst , aud software reset, and hardware standby mode. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 bit: initial value: r/w: 1514131211109876543210 bit: initial value: r/w: 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 23.3.6 aud window b end address register (auwber) auwber is a 32-bit readable/writable register. auwber designates the window b area together with auwbsr. auwber is initialized by a power-on reset, manual reset, audrst , aud software reset, and hardware standby mode. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 bit: initial value: r/w: 1514131211109876543210 bit: initial value: r/w: 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0000000000000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 935 of 1080 rej09b0230-0300 23.3.7 aud extended control register (auecsr) auecsr is a 32-bit readable/writable register. auecsr is initialized by a power-on reset, manual reset, audrst , aud software reset, and hardware standby mode. bit: initial value: r/w: bit: initial value: r/w: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 151413121110987654321 0 0000000000000000 rrrrrrrrrrrrrrrr 0000000000000001 rrrrrrr/wrrr/wrrr/wr/wr/wr ------- waob --- wbob ----- trex trsb trgn - ------ -- -- - bit bit name initial value r/w description 31 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 waob 0 r/w window a trace bus select specifies which internal bus data trace should be executed in window a. 0: specifies the l bus 1: specifies the i bus note: be sure to change this bit while the en bit in aucsr is 0 8, 7 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 6 wbob 0 r/w window b trace bus select specifies which internal bus data trace should be executed in window b. 0: specifies the l bus 1: specifies the i bus note: be sure to change this bit while the en bit in aucsr is 0
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 936 of 1080 rej09b0230-0300 bit bit name initial value r/w description 5, 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 trex 0 r/w exception branch trace select specifies whether to trace exception branch (exception, interrupt, or tre instruction) during branch trace 0: traces exception branch 1: does not trace exception branch 2 trsb 0 r/w subroutine branch trace select specifies whether to trace subroutine branch (bsr, bsrf, jsr, or rts instruction) during branch trace 0: traces subroutine branch 1: does not trace subroutine branch 1 trgn 0 r/w general branch trace select specifies whether to trace general branch (bf, bt, bf/s, bt/s, bra, braf, or jmp instruction) during branch trace 0: traces general branch 1: does not trace general branch 0 ? 1 r reserved this bit is always read as 1. the write value should always be 1.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 937 of 1080 rej09b0230-0300 23.3.8 operation arbitrary values can be set to aucsr, auecsr, auwasr, auwaer, auwbsr, and auwber as the branch trace conditions, except that the en bit in aucsr should be set to 1. the aud supports the branch trace function and window data trace function, both of which can be operated independently. furthermore, real-time tr ace mode or full trace mode can be selected as the mode to output the trace data obtained by this function. (1) aud bus command the trace data obtained by the aud is output in packet format synchronized with audck through the audata[3:0] and audsync pins. a packet consists of a command part and a data part comprising 0 to 17 data. packets are continuously output from the audata[3:0] pins. usually the command part consists of cmd1, which determines the packet type, and cmd2, which indicates the data length in the packet. other than that, a special packet that consists of only cmd1 to show aud status or a packet to which the command part of additional data is attached also exists. the level of audsync is high when in the idle state and cmd1 is output from the audata[3:0] pin, and low when cmd1e, cmd2, or data is output. details of commands are shown in table 23.6.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 938 of 1080 rej09b0230-0300 table 23.6 list of aud bus commands command cmd1 cmd1e cmd2 description stdby b'0000 ? ? shows standby state no subsequent data part exists. lost b'0001 ? ? shows data to be output is lost in real-time mode in full trace mode, lost shows that fifo in aud is full or that the cpu has temporarily stopped because of simultaneous generation of multiple traces. bpc b'0010 ? (sda) (ssa) outputs branch trace data. following this command, the branch destination address, branch source address, and address compensation value ( = pid) in the data part are output in that order. (regarding address compensation calculation, see section 23.3.8 (3), address calculation during branch trace.) sda: shows address size of branch destination ssa: shows address size of branch source sda/ssa = b'00: lower 4 bits of address sda/ssa = b'01: lower 8 bits of address sda/ssa = b'10: lower 16 bits of address sda/ssa = b'11: 32 bits full address
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 939 of 1080 rej09b0230-0300 command cmd1 cmd1e cmd2 description wdwm b'1001 (pt) (bt) (sa) (sd) outputs write access data in window data trace following this command, the write address and write data address in the data part are output in that order. pt: 1-bit identifier for the processor core that obtained data. fixed to 1 in this lsi. bt: 3-bit identifier for the bus that obtained data. bt = b'000: l bus trace bt = b'100: i bus trace bt = b'001 to b'011: reserved bt = b'101 to b'111: reserved sa: write address size sa = b'00: lower 4 bits of address sa = b'01: lower 8 bits of address sa = b'10: lower 16 bits of address sa = b'11: 32 bits full address sd: write data size sd = b'01: byte-size data (8 bits) sd = b'10: word-size data (16 bits) sd = b'11: longword-size data (32 bits) wdrm b'1101 (pt) (bt) (sa) (sd) outputs read access data for window data trace following this command, the read address and read data address in the data part are output in that order. pt: identifier for the processor core that obtained data. same as pt in wdwm. bt: identifier for the bus that obtained data. same as bt in wdwm. sa: read address size. same as sa in wdwm. sd: read data size. same as sd in wdwm.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 940 of 1080 rej09b0230-0300 (2) branch trace branch trace has functions to keep track of the event changes in the pc caused by the execution of branch instructions and the generation of interrupts, and to output the branch source address and branch destination address. branch data in a user program is traced by setting the bre, br, and en bits in aucsr and the trex, trsb, and trgn bits in auecsr. examples of branch trace output are shown in figures 23.2 to 23.4. bpc stdby 1001 da 3-0 da 11-8 da 7-4 da 15-12 sa 3-0 pid 2-0 sa 7-4 stbdy audck audsync audata[3:0] cmd1 cmd1 cmd2 pid branch destination address branch source address cmd1 figure 23.2 branch trace by bpc command (branch dest ination/source) bpc stdby 1001 sa 3-0 pid 2-0 sa 7-4 stdby audck audsync audata[3:0] cmd1 cmd1 cmd2 branch source address pid cmd1 figure 23.3 branch trace by bpc command (branc h source only) bpc stdby 1001 da 3-0 da 11-8 da 7-4 da 15-12 pid 2-0 stdby audck audsync audata[3:0] cmd1 cmd1 cmd2 branch destination address pid cmd1 figure 23.4 branch trace by bpc command (branch destination only)
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 941 of 1080 rej09b0230-0300 in either of the three cases, the same signal is output to cmd1, cmd2, and pid, such that bpc (b'0010) is output to cmd1 and (ssa)/(sda) to cmd2. when outputting the branch destination only, the branch destination address of the previous branch is subject to comparison, not the br anch source address of the previous branch. in a user program, branch data is not output while branch events (such as execution of a branch instruction and interrupts) are not generated. when branch events are generated, audata[3:0] outputs the trace data in the order of command, bran ch destination address, branch source address, and pid. address sizes output for both branch destination and branch source (4/8/16/32 bits) are determined by comparing the upper bits of both addresses based on the value of pfba (branch destination output previous time). the algorithm is shown in figure 23.5. [legend] pfba: branch destination address output previous time cda: branch destination address output this time csa: branch source address output this time pid: compensation value to generate correct branch source address tsa: correct branch source address ******************************************************************************************** /* pfba_enable = 0: initial value */ if(pfba_enable == 0) {output32bit(cda[31:0]);} else if(pfba[31:4] == cda[31:4]) {output4bit(cda[3:0]);} else if(pfba[31:8] == cda[31:8]) {output8bit(cda[7:0]);} else if(pfba[31:16] == cda[31:16]) {output16bit(cda[15:0]);} else {output32bit(cda[31:0]);} if(pfba_enable == 0) {output32bit(csa[31:0]);} else if(pfba[31:4] == csa[31:4]) {output4bit(csa[3:0]);} else if(pfba[31:8] == csa[31:8]) {output8bit(csa[7:0]);} else if(pfba[31:16] == csa[31:16]) {output16bit(csa[15:0]);} else {output32bit(csa[31:0]);} pfba_enable = 1; pfba = cda; /* update pfba */ ******************************************************************************************** calculate actual branch source address using the following equation. tsa = csa.(2*pid) figure 23.5 branch trace algorithm this algorithm can greatly reduce the amount of trace data to be output. branch trace data is stored in fifo as long as fifo has room to store it. the cpu operation when fifo becomes full depends upon the setting of the tm bit in aucsr.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 942 of 1080 rej09b0230-0300 (3) address calculation during branch trace (a) when an interrupt is generated immediat ely before executing a branch instruction the address of a branch source instruction is given by tsa = csa, but the equation tsa = csa ? (2 pid) must be used in other processors. to eliminate this complication, pid is always set to 0 to make the case common for both equations. (b) address calculation of branch source the part branch source address (tsa) depends on the type of branch. ? branch instruction tsa indicates the branch instruction address ? interrupt tsa indicates the address of the instruction executed imme diately before the interrupt. the address of the first instruction of the interrupt routine is output as cda. ? exception when the instruction at exception generation is a completion type, tsa indicates the address of the next instruction. if the instruction at exception generation is a rerun type, tsa indicates the address of the instruction. the address of the first instruction of the exception routine is output as cda. (4) window data trace window data trace has a function to output memory access data generated in an area designated by two address pointers (called the window) to outside. the aud supports windows of channels a and b. the region for window a is designated by auwasr and auwaer. the region for window b is designated by auwbsr and auwber. memory access data is traced by setting the wa0, wa1, wb0, and wb1 bits in aucsr and then setting the en bit to 1. figure 23.6 shows an exampl e of window data trace. wdwm stdby 0100 a 3-0 a 11-8 a 7-4 a 15-12 d 3-0 d 11-8 d 15-12 d 7-4 stdby audck audsync audata[3:0] cmd1 cmd1 cmd1e 1010 cmd2 accessed data address contents of data cmd1 figure 23.6 window data trace with wdwm command
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 943 of 1080 rej09b0230-0300 in a user program, when data access to a wi ndow area is generated, audata[3:0] outputs the trace data in the order of command, accessed addre ss, and the data contents. similar to a branch trace, the address sizes output (4/8/16/32 bits) ar e determined by comparing the upper bits of both addresses based on the value of pfda (the address output the previous time). the data contents are output as they are in th eir access sizes (8/16/32 bits). the algorithm is shown in figure 23.7. [legend] pfda: data address output in 32-bit size previous time cda: data address output this time /* pfda_enable = 0: initial value */ if(pfda_enable == 0) {output32bit(cda[31:0]);} else if(pfda[31:4] == cda[31:4]) {output4bit(cda[3:0]);} else if(pfda[31:8] == cda[31:8]) {output8bit(cda[7:0]);} else if(pfda[31:16] == cda[31:16]) {output16bit(cda[15:0]);} else {output32bit(cda[31:0]);} pfda_enable = 1; pfda = cda; /* update pfda */ figure 23.7 window data trace algorithm this algorithm can greatly reduce the amount of trace data to be output. branch trace data is stored in fifo as long as fifo has room to store it. the cpu operation when fifo becomes full depends on the setting of the tm bit in aucsr. (5) real-time trace mode in real-time trace mode, various trace data obtai ned through branch trace and window data trace are output to the outside in real time through audata[3:0]. setting the tm bit in aucsr to 1 selects real-time trace mode. in real-time trace mode, the cpu keeps operating while trace data is being output in the same way as when no trace function is used. tr ace events that emerge are stored in fifo one after another as long as fifo has room for them, and are output outward. if fifo has no room for them, trace events are not stored and nothing is output outside. in this case, outside notification of a data acquisition failure is provided through the lost command. when the lost command is issued, audsync is always driven to l in the next cycle after the lost command. when more than one event simultaneously occur, th e priority is based on the order of branch trace and window data trace and only one selected event is stored in fifo. in this case, the lost command provides outside notification that there are events not stored in fifo.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 944 of 1080 rej09b0230-0300 figure 23.8 shows an example in which more than one trace data are lost from two branch trace events to be output. figure 23.9 is an exam ple where stdby comes after the lost command. bpc da 3-0 da 7-4 sa 3-0 pid 2-0 pid 2-0 sa 7-4 audck audsync audata[3:0] cmd1 lost cmd1 bpc cmd1 0100 cmd1 0001 cmd2 branch destination address da 3-0 branch destination address branch source address pid pid sa 3-0 branch source address lost command forcibly drives audsync to low figure 23.8 example of failure to get trace data during real-time trace audck audsync audata[3:0] lost cmd1 stdby cmd1 cmd1 figure 23.9 example where stdby comes after the lost command (6) full trace mode in full trace mode, all trace data is output outside without fail. full trace mode can be selected by setting the tm bit in aucsr to 0. trace data ge nerated in full trace mode is output outside through the internal fifo in aud. when fifo becomes full, the cpu stops operation until fifo outputs its data. in this case, unlike the real-t ime trace mode, trace data is not lost. when the cpu temporarily stops operating because fifo is full, the lost command provides notifica tion that the cpu has temporarily stopped. however, audsync is always driven to l in the next cycle after the lost command in the same manner as for real-time trace.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 945 of 1080 rej09b0230-0300 (7) address comparison and outputting data from different parts of the address to effectively utilize the narrow bandwidth of the aud bus, only necessary lower bits in the address of trace data are select ed and output based on the prev iously output address which is retained in pfba and pfda in the internal register. the address data size for the branch destinati on/source that branch trace outputs or the address data of software trace (4/8/16/32 bits) is determined by comparison matching between the upper bits of both addresses based on the fpda data. data in fpba and fpda are renewed every time the trace data that was subject to comparison is output. fpba and fpda are disabled when the en bit in aucsr is changed from 1 to 0 or when the output counter has overflown. when fpba and fpda are disabled, the address part of trace data is output in 32-bit length. the output counter is in cremented at every trace event generation, and is cleared every time 128 trace data are output. when the en bit in aucsr is changed from 1 to 0, the output counter is also cleared to 0. the output counter functions as a recovery method in case the trace data the aud has output is ruined for some reason. figure 23.10 shows an example of address comparison matching.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 946 of 1080 rej09b0230-0300 output counter clear counter pfba update control br: branch trace wd: window data trace pfba: previous full branch address pfda: previous full data address access size - - br wd wd br br wd br destination 3 wd address 3 wd address 2 br destination 2 br destination 1 wd address 1 br source 3 wd data 3 wd data 2 br source 2 br source 1 wd data 1 - 8 8 - - 32 cmp1 cmp2 p-p conversion fifo pfda [legend] figure 23.10 example of address comparison matching
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 947 of 1080 rej09b0230-0300 1. wd address 1 and pfda undergo comparison matching at cmp1 and the lower bits of wd address 1 are output (4/8/16/32 bits) according to the comparison result. the entire 32-bit wd data 1 is then output and pdfa is renewed to wd address 1. 2. br destination 1 and pfba undergo comparison matching at cmp1, and br source 1 and pfba undergo comparison matching at cmp2. the lower bits of br destination 1 are then output (4/8/16/32 bits) according to the compar ison result at cmp1. the lower bits of br source 1 are also output (4/8/16/32 bits) accord ing to the comparison result at cmp2. after that, pfba is renewed to br destination 1. 3. br destination 2 and pfba undergo comparison matching at cmp1, and br source 2 and pfba undergo comparison matching at cmp2. pfba retains the value of br destination 1 as stored in step (2). the lower bits of br des tination 2 are then output (4/8/16/32 bits) according to the comparison result at cmp1. the lower bits of br source 2 are also output (4/8/16/32 bits) according to the comparison result at cmp2. afte r that, pfba is renewed to br destination 2. 4. wd address 2 and pfda undergo comparison matching at cmp1. pfda retains the value of wd address 1 stored in step (1). the lower bits of wd address 2 are output (4/8/16/32 bits) according to the comparison result. an 8-bit wd data 1 is then output as it is and pdfa is renewed to wd address 2. 5. when the output counter overflows, pfba a nd pfda are disabled. at the same time, the branch destination, branch source, and data addr ess part in the trace data are always output in 32-bit length. 23.3.9 usage notes (branch trace mode) (1) guidelines for initialization of branch trace mode the buffer in this debugger and the processi ng status are initialized under the following conditions. ? power-on reset ? manual reset ? hardware standby ? low level is input to the audrst pin ? software reset (when the audsrst bit in stbcr6 is cleared to 0) ? the en bit in aucsr is changed from 0 to 1 fifo in the aud is cleared.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 948 of 1080 rej09b0230-0300 pfba and pfda are disabled. after the en bit shifte d to 1, the first output address part of each trace event is output in 32-bit length. (2) guidelines for audck ? when the en bit in aucsr is set to 1, audck outputs the clock. when the en bit is set to 0, no clock is output. ? audck stops in standby mode. during this pe riod, all values output from aud and the aud?s internal state are retain ed. returning from standby restarts the halted processing. ? changing the clk0 and clk1 bits in aucsr must be done while the en bit in aucsr is 0. ? do not set audck to a frequency higher than 20 mhz. (3) writing to the aud register ? values for the aud are written through the i bus. therefore, in the cycle immediately after rewriting the aud register, no trace with a change d condition can be generated. to acquire the timing when a condition of the aud register has changed, read the register that was rewritten in the last stage one time. traces after that are valid for the newly written register values. ? changing the aud register other than aucsr must be done while the en bit in aucsr is 0. (4) other limitations ? bt whose displacement is 0 and branch data by the bt instruction are also output. the instruction codes for these are h'8900 and h'8b00. ? if fifo in the aud holds valid data, the aud out puts these data even after the trace function is disabled, resulting in interna lly being disabled. do not enable the trace function while these data in fifo are being output. confirm that the aud is not outputting the data and then enable the trace function in the aud. ? fifo in the aud is commonly used with fifo for pc trace in the ubc. therefore, simultaneous use of pc trace in both aud and ubc is prohibited. ? when the pin function of the aud is selected by the pin function controller (pfc), do not shift the aud to the module standby mode.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 949 of 1080 rej09b0230-0300 23.4 ram monitor mode in this mode, all the modules connected to this lsi's internal or external bus can be read and written to, allowing ram monitoring and tuning to be carried out. 23.4.1 communication protocol the aud latches the audata input when audsync is asserted. the following audata input format should be used. 0000 dir a3 to a0 a31 to a28 d3 to d0 dn to dn-3 spare bits (4 bits): b'0000 command fixed at 1 0: read 1: write 00: byte 01: word 10: longword bit 3 bit 2 bit 1 bit 0 address data (in case of write only) b write: n = 7 w write: n = 15 l write: n = 31 figure 23.11 audata input format 23.4.2 operation operation starts in ram monitor mode when audrst is asserted, audmd is driven high, and then audrst is negated. figure 23.12 shows an example of a read operation, and figure 23.13 shows an example of a write operation. when audsync is asserted, input from the audata pins begins. when a command, address, or data (writing only) is input in the format s hown in figure 23.11, execution of read/write access to the specified address is started. during internal execution, the aud returns not ready (b'0000). when execution is completed, the ready flag (b'0001) is returned (figures 23.12 and 23.13). table 23.7 shows the ready flag format.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 950 of 1080 rej09b0230-0300 in a read, data of the specified size is output when audsync is negated following detection of this flag (figure 23.12). if a command other than the above is input in dir, the aud treats this as a command error, disables processing, and sets bit 1 in the ready flag to 1. if a read/write operation initiated by the command specified in dir causes a bus error, the aud disables processing and sets bit 2 in the ready flag to 1 (figure 23.14). bus error conditions are shown below. 1. word access to address 4n+1 or 4n+3 2. longword access to address 4n+1, 4n+2, or 4n+3 3. access to an external area in single-chip mode table 23.7 ready flag format bit 3 bit 2 bit 1 bit 0 fixed at 0 0: normal status 1: bus error 0: normal status 1: command error 0: not ready 1: ready 0000 a3 to a0 audck audsync audata[3:0] 1000 0001 0001 0000 0001 a31 to a28 d3 to d0 d7 to d4 dir not ready ready ready ready input output input/output changeover figure 23.12 example of read operation (byte read) 0000 a3 to a0 1110 0001 0001 0000 0001 d31 to d28 a31 to a28 d3 to d0 dir not ready ready ready ready audck audsync audata[3:0] input output input/output changeover figure 23.13 example of write operation (longword write)
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 951 of 1080 rej09b0230-0300 0000 a3 to a0 1010 0101 0101 0000 0101 a31 to a28 dir not ready ready (bus error) ready (bus error) audck audsync audata[3:0] input output input/output changeover figure 23.14 example of e rror occurrence (longword read) 23.4.3 usage notes (ram monitor mode) (1) guidelines for initialization of the ram monitor mode the buffers in the aud and the processing stat us are initialized under the following conditions. ? power-on reset ? manual reset ? hardware standby ? when the audrst pin is driven to low ? software reset (when the audsrst bit in stbcr6 is cleared to 0) (2) guidelines for audck ? audck is for inputting the external clock. in put the clock to be used for debugging. ? set the frequency of audck to sa tisfy the following conditions: lo wer than or equal to both 10 mhz and 1/4 of p . (3) other limitations ? do not assert audsync until the command is input and the necessary data is prepared. ? do not shift the aud to the software standby mode while the sram monitor function is working. ? when the pin function of the aud is selected through the pin function controller (pfc), do not shift the aud to the module standby mode.
section 23 advanced user debugger (aud) rev. 3.00 oct. 06, 2008 page 952 of 1080 rej09b0230-0300
section 24 list of registers rev. 3.00 oct. 06, 2008 page 953 of 1080 rej09b0230-0300 section 24 list of registers this section gives information on internal i/o regist ers. the contents of this section are as follows: 1. register address table (in the order from a lower address) ? registers are listed in the order from lower allocated addresses. ? as for reserved addresses, the register name column is indicated with ? . do not access reserved addresses. ? as for 16- or 32-bit address, the msb addresses are shown. ? the list is classified acco rding to module names. ? the numbers of access cycles are given. 2. register bit table ? bit configurations are shown in the order of the register address table. ? as for reserved bits, the bit name column is indicated with ? . ? as for the blank column of the bit names, the whole register is allocated to the counter or data. ? as for 16- or 32-bit registers, bits are indicated from the msb. 3. register state in each operating mode ? register states are listed in the or der of the register address table. ? register states in the basic operating mode are shown. as for modules including their specific states such as reset, see the sections of those modules.
section 24 list of registers rev. 3.00 oct. 06, 2008 page 954 of 1080 rej09b0230-0300 24.1 register address table (in the order of addresses) access sizes are indicated as the number of bits. access cycles are the number of cycles of the indicated reference clock, and the values are s hown for 8-bit access (b), 16-bit access (w), or 32- bit access (l). notes: 1. access to undefined locations or reserved addresses is prohibited. correct operation cannot be guaranteed if such addresses are accessed. 2. access to mailbox areas of the rcan-et may include wait cycles of 0 to 5 p cycles. register name abbreviation no. of bits address module access size no. of access cycles connected bus width serial mode register_0 scsmr_0 8 h'ffffc000 8 bit rate register_0 scbrr_0 8 h'ffffc002 8 serial control register_0 scscr_0 8 h'ffffc004 8 transmit data register_0 sctdr_0 8 h'ffffc006 8 serial status register_0 scssr_0 8 h'ffffc008 8 receive data register_0 scrdr_0 8 h'ffffc00a 8 serial direction control register_0 scsdcr_0 8 h'ffffc00c 8 serial port register_0 scsptr_0 8 h'ffffc00e sci (channel 0) 8 p (reference clock) b: 2 16 bits serial mode register_1 scsmr_1 8 h'ffffc080 8 bit rate register_1 scbrr_1 8 h'ffffc082 8 serial control register_1 scscr_1 8 h'ffffc084 8 transmit data register_1 sctdr_1 8 h'ffffc086 8 serial status register_1 scssr_1 8 h'ffffc088 8 receive data register_1 scrdr_1 8 h'ffffc08a 8 serial direction control register_1 scsdcr_1 8 h'ffffc08c 8 serial port register_1 scsptr_1 8 h'ffffc08e sci (channel 1) 8 p (reference clock) b: 2 16 bits serial mode register_2 scsmr_2 8 h'ffffc100 8 bit rate register_2 scbrr_2 8 h'ffffc102 8 serial control register_2 scscr_2 8 h'ffffc104 8 transmit data register_2 sctdr_2 8 h'ffffc106 8 serial status register_2 scssr_2 8 h'ffffc108 sci (channel 2) 8 p (reference clock) b: 2 16 bits receive data register_2 scrdr_2 8 h'ffffc10a 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 955 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width serial direction control register_2 scsdcr_2 8 h'ffffc10c 8 serial port register_2 scsptr_2 8 h'ffffc10e sci (channel 2) 8 p (reference clock) b: 2 16 bits timer control register_3 tcr_3 8 h'ffffc200 8, 16, 32 timer control register_4 tcr_4 8 h'ffffc201 8 timer mode register_3 tmdr_3 8 h'ffffc202 8, 16 timer mode register_4 tmdr_4 8 h'ffffc203 8 timer i/o control register h_3 tiorh_3 8 h'ffffc204 8, 16, 32 timer i/o control register l_3 tiorl_3 8 h'ffffc205 8 timer i/o control register h_4 tiorh_4 8 h'ffffc206 8, 16 timer i/o control register l_4 tiorl_4 8 h'ffffc207 8 timer interrupt enable register_3 tier_3 8 h'ffffc208 8, 16 timer interrupt enable register_4 tier_4 8 h'ffffc209 8 timer output master enable register toer 8 h'ffffc20a 8 timer gate control register tgcr 8 h'ffffc20d 8 timer output control register 1 tocr1 8 h'ffffc20e 8, 16 timer output control register 2 tocr2 8 h'ffffc20f 8 timer counter_3 tcnt_3 16 h'ffffc210 16, 32 timer counter_4 tcnt_4 16 h'ffffc212 16 timer cycle data register tcdr 16 h'ffffc214 16, 32 timer dead time data register tddr 16 h'ffffc216 16 timer general register a_3 tgra_3 16 h'ffffc218 16, 32 timer general register b_3 tgrb_3 16 h'ffffc21a 16 timer general register a_4 tgra_4 16 h'ffffc21c 16, 32 timer general register b_4 tgrb_4 16 h'ffffc21e 16 timer sub-counter tcnts 16 h'ffffc220 16, 32 timer cycle buffer register tcbr 16 h'ffffc222 16 timer general register c_3 tgrc_3 16 h'ffffc224 16, 32 timer general register d_3 tgrd_3 16 h'ffffc226 16 timer general register c_4 tgrc_4 16 h'ffffc228 mtu2 16, 32 mp (reference clock) b: 2 w: 2 l: 4 16 bits timer general register d_4 tgrd_4 16 h'ffffc22a 16
section 24 list of registers rev. 3.00 oct. 06, 2008 page 956 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width timer status register_3 tsr_3 8 h'ffffc22c 8, 16 timer status register_4 tsr_4 8 h'ffffc22d 8 timer interrupt skipping set register titcr 8 h'ffffc230 8, 16 timer interrupt skipping counter titcnt 8 h'ffffc231 8 timer buffer transfer set register tbter 8 h'ffffc232 8 timer dead time enable register tder 8 h'ffffc234 8 timer output level buffer register tolbr 8 h'ffffc236 8 timer buffer operation transfer mode register_3 tbtm_3 8 h'ffffc238 8, 16 timer buffer operation transfer mode register_4 tbtm_4 8 h'ffffc239 8 timer a/d converter start request control register tadcr 16 h'ffffc240 16 timer a/d converter start request cycle set register a_4 tadcora_4 16 h'ffffc244 16, 32 timer a/d converter start request cycle set register b_4 tadcorb_4 16 h'ffffc246 16 timer a/d converter start request cycle set buffer register a_4 tadcobra_4 16 h'ffffc248 16, 32 timer a/d converter start request cycle set buffer register b_4 tadcobrb_4 16 h'ffffc24a 16 timer waveform control register twcr 8 h'ffffc260 8 timer start register tstr 8 h'ffffc280 8, 16 timer synchronous register tsyr 8 h'ffffc281 8 timer counter synchronous start register tcsystr 8 h'ffffc282 8 timer read/write enable register trwer 8 h'ffffc284 8 timer control register_0 tcr_0 8 h'ffffc300 8, 16, 32 timer mode register_0 tmdr_0 8 h'ffffc301 8 timer i/o control register h_0 tiorh_0 8 h'ffffc302 8, 16 timer i/o control register l_0 tiorl_0 8 h'ffffc303 8 timer interrupt enable register_0 tier_0 8 h'ffffc304 mtu2 8, 16, 32 mp (reference clock) b: 2 w: 2 l: 4 16 bits timer status register_0 tsr_0 8 h'ffffc305 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 957 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width timer counter_0 tcnt_0 16 h'ffffc306 16 timer general register a_0 tgra_0 16 h'ffffc308 16, 32 timer general register b_0 tgrb_0 16 h'ffffc30a 16 timer general register c_0 tgrc_0 16 h'ffffc30c 16, 32 timer general register d_0 tgrd_0 16 h'ffffc30e 16 timer general register e_0 tgre_0 16 h'ffffc320 16, 32 timer general register f_0 tgrf_0 16 h'ffffc322 16 timer interrupt enable register 2_0 tier2_0 8 h'ffffc324 8, 16 timer status register 2_0 tsr2_0 8 h'ffffc325 8 timer buffer operation transfer mode register_0 tbtm_0 8 h'ffffc326 8 timer control register_1 tcr_1 8 h'ffffc380 8, 16 timer mode register_1 tmdr_1 8 h'ffffc381 8 timer i/o control register_1 tior_1 8 h'ffffc382 8 timer interrupt enable register_1 tier_1 8 h'ffffc384 8, 16, 32 timer status register_1 tsr_1 8 h'ffffc385 8 timer counter_1 tcnt_1 16 h'ffffc386 16 timer general register a_1 tgra_1 16 h'ffffc388 16, 32 timer general register b_1 tgrb_1 16 h'ffffc38a 16 timer input capture control register ticcr 8 h'ffffc390 8 timer control register_2 tcr_2 8 h'ffffc400 8, 16 timer mode register_2 tmdr_2 8 h'ffffc401 8 timer i/o control register_2 tior_2 8 h'ffffc402 8 timer interrupt enable register_2 tier_2 8 h'ffffc404 8, 16, 32 timer status register_2 tsr_2 8 h'ffffc405 8 timer counter_2 tcnt_2 16 h'ffffc406 16 timer general register a_2 tgra_2 16 h'ffffc408 mtu2 16, 32 mp (reference clock) b: 2 w: 2 l: 4 16 bits timer general register b_2 tgrb_2 16 h'ffffc40a 16
section 24 list of registers rev. 3.00 oct. 06, 2008 page 958 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width timer control register_3s tcr_3s 8 h'ffffc600 8, 16, 32 timer control register_4s tcr_4s 8 h'ffffc601 8 timer mode register_3s tmdr_3s 8 h'ffffc602 8, 16 timer mode register_4s tmdr_4s 8 h'ffffc603 8 timer i/o control register h_3s tiorh_3s 8 h'ffffc604 8, 16, 32 timer i/o control register l_3s tiorl_3s 8 h'ffffc605 8 timer i/o control register h_4s tiorh_4s 8 h'ffffc606 8, 16 timer i/o control register l_4s tiorl_4s 8 h'ffffc607 8 timer interrupt enable register_3s tier_3s 8 h'ffffc608 8, 16 timer interrupt enable register_4s tier_4s 8 h'ffffc609 8 timer output master enable register s toers 8 h'ffffc60a 8 timer gate control register s tgcrs 8 h'ffffc60d 8 timer output control register 1s tocr1s 8 h'ffffc60e 8, 16 timer output control register 2s tocr2s 8 h'ffffc60f 8 timer counter_3s tcnt_3s 16 h'ffffc610 16, 32 timer counter_4s tcnt_4s 16 h'ffffc612 16 timer cycle data register s tcdrs 16 h'ffffc614 16, 32 timer dead time data register s tddrs 16 h'ffffc616 16 timer general register a_3s tgra_3s 16 h'ffffc618 16, 32 timer general register b_3s tgrb_3s 16 h'ffffc61a 16 timer general register a_4s tgra_4s 16 h'ffffc61c 16, 32 timer general register b_4s tgrb_4s 16 h'ffffc61e 16 timer sub-counter s tcntss 16 h'ffffc620 16, 32 timer cycle buffer register s tcbrs 16 h'ffffc622 16 timer general register c_3s tgrc_3s 16 h'ffffc624 16, 32 timer general register d_3s tgrd_3s 16 h'ffffc626 16 timer general register c_4s tgrc_4s 16 h'ffffc628 16, 32 timer general register d_4s tgrd_4s 16 h'ffffc62a 16 timer status register_3s tsr_3s 8 h'ffffc62c mtu2s 8, 16 mi (reference clock) b: 2 w: 2 l: 4 16 bits timer status register_4s tsr_4s 8 h'ffffc62d 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 959 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width timer interrupt skipping set register s titcrs 8 h'ffffc630 8, 16 timer interrupt skipping counter s titcnts 8 h'ffffc631 8 timer buffer transfer set register s tbters 8 h'ffffc632 8 timer dead time enable register s tders 8 h'ffffc634 8 timer output level buffer register s tolbrs 8 h'ffffc636 8 timer buffer operation transfer mode register_3s tbtm_3s 8 h'ffffc638 8, 16 timer buffer operation transfer mode register_4s tbtm_4s 8 h'ffffc639 8 timer a/d converter start request control register s tadcrs 16 h'ffffc640 16 timer a/d converter start request cycle set register a_4s tadcora_4s 16 h'ffffc644 16, 32 timer a/d converter start request cycle set register b_4s tadcorb_4s 16 h'ffffc646 16 timer a/d converter start request cycle set buffer register a_4s tadcobra_4s 16 h'ffffc648 16, 32 timer a/d converter start request cycle set buffer register b_4s tadcobrb_4s 16 h'ffffc64a 16 timer synchronous clear register s tsycrs 8 h'ffffc650 8 timer waveform control register s twcrs 8 h'ffffc660 8 timer start register s tstrs 8 h'ffffc680 8, 16 timer synchronous register s tsyrs 8 h'ffffc681 8 timer read/write enable register s trwers 8 h'ffffc684 8 timer counter u_5s tcntu_5s 16 h'ffffc880 16, 32 timer general register u_5s tgru_5s 16 h'ffffc882 16 timer control register u_5s tcru_5s 8 h'ffffc884 8 timer i/o control register u_5s tioru_5s 8 h'ffffc886 8 timer counter v_5s tcntv_5s 16 h'ffffc890 16, 32 timer general register v_5s tgrv_5s 16 h'ffffc892 16 timer control register v_5s tcrv_5s 8 h'ffffc894 mtu2s 8 mi (reference clock) b: 2 w: 2 l: 4 16 bits timer i/o control register v_5s tiorv_5s 8 h'ffffc896 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 960 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width timer counter w_5s tcntw_5s 16 h'ffffc8a0 16, 32 timer general register w_5s tgrw_5s 16 h'ffffc8a2 16 timer control register w_5s tcrw_5s 8 h'ffffc8a4 8 timer i/o control register w_5s tiorw_5s 8 h'ffffc8a6 8 timer status register_5s tsr_5s 8 h'ffffc8b0 8 timer interrupt enable register_5s tier_5s 8 h'ffffc8b2 8 timer start register_5s tstr_5s 8 h'ffffc8b4 8 timer compare match clear register s tcntcmpclrs 8 h'ffffc8b6 mtu2s 8 mi (reference clock) b: 2 w: 2 l: 4 16 bits flash code control/status r egister fccs 8 h'ffffcc00 8 flash program code select register fpcs 8 h'ffffcc01 8 flash erase code select register fecs 8 h'ffffcc02 8 flash key code register fkey 8 h'ffffcc04 8 flash mat select register fmats 8 h'ffffcc05 8 flash transfer destination address register ftdar 8 h'ffffcc06 flash 8 p (reference clock) b: 5 16 bits dtc enable register a dtcera 16 h'ffffcc80 8, 16 dtc enable register b dtcerb 16 h'ffffcc82 8, 16 dtc enable register c dtcerc 16 h'ffffcc84 8, 16 dtc enable register d dtcerd 16 h'ffffcc86 8, 16 dtc enable register e dtcere 16 h'ffffcc88 8, 16 dtc control register dtccr 8 h'ffffcc90 8 dtc vector base register dtcvbr 32 h'ffffcc94 dtc 8, 16, 32 p (reference clock) b: 2 w: 2 l: 4 16 bits ss control register h sscrh 8 h'ffffcd00 8, 16 ss control register l sscrl 8 h'ffffcd01 8 ss mode register ssmr 8 h'ffffcd02 8, 16 ss enable register sser 8 h'ffffcd03 8 ss status register sssr 8 h'ffffcd04 8, 16 ss control register 2 sscr2 8 h'ffffcd05 8 ss transmit data register 0 sstdr0 8 h'ffffcd06 8, 16 ss transmit data register 1 sstdr1 8 h'ffffcd07 synchronous serial comm- unication unit 8 p (reference clock) b: 2 w: 2 16 bits ss transmit data register 2 sstdr2 8 h'ffffcd08 8, 16
section 24 list of registers rev. 3.00 oct. 06, 2008 page 961 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width ss transmit data register 3 sstdr3 8 h'ffffcd09 8 ss receive data register 0 ssrdr0 8 h'ffffcd0a 8, 16 ss receive data register 1 ssrdr1 8 h'ffffcd0b 8 ss receive data register 2 ssrdr2 8 h'ffffcd0c 8, 16 ss receive data register 3 ssrdr3 8 h'ffffcd0d synchronous serial comm- unication unit 8 p (reference clock) b: 2 w: 2 16 bits compare match timer start register cmstr 16 h'ffffce00 8, 16, 32 compare match timer control/status register_0 cmcsr_0 16 h'ffffce02 8, 16 compare match counter_0 cmcnt_0 16 h'ffffce04 8, 16, 32 compare match constant register_0 cmcor_0 16 h'ffffce06 8, 16 compare match timer control/status register_1 cmcsr_1 16 h'ffffce08 8, 16, 32 compare match counter_1 cmcnt_1 16 h'ffffce0a 8, 16 compare match constant register_1 cmcor_1 16 h'ffffce0c cmt 8, 16, 32 p (reference clock) b: 2 w: 2 l: 4 16 bits input level control/status register 1 icsr1 16 h'ffffd000 8, 16, 32 output level control/status register 1 ocsr1 16 h'ffffd002 8, 16 input level control/status register 2 icsr2 16 h'ffffd004 8, 16, 32 output level control/status register 2 ocsr2 16 h'ffffd006 8, 16 input level control/status register 3 icsr3 16 h'ffffd008 8, 16 software port output enable register spoer 8 h'ffffd00a 8 port output enable control register 1 poecr1 8 h'ffffd00b 8 port output enable control register 2 poecr2 16 h'ffffd00c poe 8, 16 p (reference clock) b: 2 w: 2 l: 4 16 bits port a data register l padrl 16 h'ffffd102 i/o 8, 16 port a i/o register l paiorl 16 h'ffffd106 8, 16 port a control register l4 pacrl4 16 h'ffffd110 8, 16, 32 port a control register l3 pacrl3 16 h'ffffd112 8, 16 port a control register l2 pacrl2 16 h'ffffd114 8, 16, 32 port a control register l1 pacrl1 16 h'ffffd116 pfc 8, 16 port a port register l paprl 16 h'ffffd 11e i/o 8, 16 p (reference clock) b: 2 w: 2 l: 4 16 bits port b data register l pbdrl 16 h'ffffd182 8, 16
section 24 list of registers rev. 3.00 oct. 06, 2008 page 962 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width port b i/o register l pbiorl 16 h'ffffd186 8, 16 port b control register l2 pbcrl2 16 h'ffffd194 8, 16, 32 port b control register l1 pbcrl1 16 h'ffffd196 pfc 8, 16 port b port register l pbprl 16 h'ffffd19e 8, 16 port d data register l pddrl 16 h'ffffd282 i/o 8, 16 port d i/o register l pdiorl 16 h'ffffd286 8, 16 port d control register l3 pdcrl3 16 h'ffffd292 8, 16 port d control register l2 pdcrl2 16 h'ffffd294 8, 16, 32 port d control register l1 pdcrl1 16 h'ffffd296 pfc 8, 16 port d port register l pdprl 16 h'ffffd29e 8, 16 port e data register h pedrh 16 h'ffffd300 8, 16, 32 port e data register l pedrl 16 h'ffffd302 i/o 8, 16 port e i/o register h peiorh 16 h'ffffd304 8, 16, 32 port e i/o register l peiorl 16 h'ffffd306 8, 16 port e control register h2 pecrh2 16 h'ffffd30c 8, 16, 32 port e control register h1 pecrh1 16 h'ffffd30e 8, 16 port e control register l4 pecrl4 16 h'ffffd310 8, 16, 32 port e control register l3 pecrl3 16 h'ffffd312 8, 16 port e control register l2 pecrl2 16 h'ffffd314 8, 16, 32 port e control register l1 pecrl1 16 h'ffffd316 pfc 8, 16 port e port register h peprh 16 h'ffffd31c 8, 16, 32 port e port register l peprl 16 h'ffffd31e i/o 8, 16 p (reference clock) b: 2 w: 2 l: 4 16 bits a/d control register_0 adcr_0 8 h'ffffd400 8 a/d status register_0 adsr_0 8 h'ffffd402 8 a/d start trigger select register_0 adstrgr_0 8 h'ffffd41c 8 a/d analog input channel select register_0 adansr_0 8 h'ffffd420 8 a/d data register 0 addr0 16 h'ffffd440 16 a/d data register 1 addr1 16 h'ffffd442 16 a/d data register 2 addr2 16 h'ffffd444 a/d (channel 0) 16 p (reference clock) b: 2 w: 2 16 bits a/d data register 3 addr3 16 h'ffffd446 16
section 24 list of registers rev. 3.00 oct. 06, 2008 page 963 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width a/d data register 4 addr4 16 h'ffffd448 16 a/d data register 5 addr5 16 h'ffffd44a 16 a/d data register 6 addr6 16 h'ffffd44c 16 a/d data register 7 addr7 16 h'ffffd44e a/d (channel 0) 16 p (reference clock) b: 2 w: 2 16 bits a/d control register_1 adcr_1 8 h'ffffd600 8 a/d status register_1 adsr_1 8 h'ffffd602 8 a/d start trigger select register_1 adstrgr_1 8 h'ffffd61c 8 a/d analog input channel select register_1 adansr_1 8 h'ffffd620 8 a/d data register 8 addr8 16 h'ffffd640 a/d (channel 1) 16 p (reference clock) b: 2 w: 2 16 bits a/d data register 9 addr9 16 h'ffffd642 16 a/d data register 10 addr10 16 h'ffffd644 16 a/d data register 11 addr11 16 h'ffffd646 16 a/d data register 12 addr12 16 h'ffffd648 16 a/d data register 13 addr13 16 h'ffffd64a 16 a/d data register 14 addr14 16 h'ffffd64c 16 a/d data register 15 addr15 16 h'ffffd64e a/d (channel 1) 16 p (reference clock) b: 2 w: 2 16 bits master control register_0 mcr_0 16 h'ffffd800 16 general status register_0 gsr_0 16 h'ffffd802 16 bit configuration register 1_0 bcr1_0 16 h'ffffd804 16 bit configuration register 0_0 bcr0_0 16 h'ffffd806 16 interrupt request register_0 irr_0 16 h'ffffd808 16 interrupt mask register_0 imr_0 16 h'ffffd80a 16 transmit error counter_0/ receive error counter_0 tec_0/rec_0 16 h'ffffd80c 16 transmit wait register 1_0, transmit wait register 0_0 txpr1_0, txpr0_0 32 h'ffffd820 32 transmit cancel register 0_0 txcr0_0 16 h'ffffd82a 16 transmit acknowledge register 0_0 txack0_0 16 h'ffffd832 16 abort acknowledge register 0_0 aback 0_0 16 h'ffffd83a 16 receive end register 0_0 rxpr0_0 16 h'ffffd842 rcan-et (channel 0) 16 p (reference clock) b: 2 w: 2 l: 4 16 bits remote frame request register 0_0 rfpr0_0 16 h'ffffd84a 16
section 24 list of registers rev. 3.00 oct. 06, 2008 page 964 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width mailbox interrupt mask register 0_0 mbimr0_0 16 h'ffffd852 16 unread message status register 0_0 umsr0_0 16 h'ffffd85a 16 control0h ? 16 h'ffffd900 16, 32 control0l ? 16 h'ffffd902 16 lafmh ? 16 h'ffffd904 16, 32 lafml ? 16 h'ffffd906 16 msg_data[0] ? 8 h'ffffd908 8, 16, 32 msg_data[1] ? 8 h'ffffd909 8 msg_data[2] ? 8 h'ffffd90a 8, 16 msg_data[3] ? 8 h'ffffd90b 8 msg_data[4] ? 8 h'ffffd90c 8, 16, 32 msg_data[5] ? 8 h'ffffd90d 8 msg_data[6] ? 8 h'ffffd90e 8, 16 msg_data[7] ? 8 h'ffffd90f 8 control1h ? 8 h'ffffd910 8, 16 mb[0]. control1l ? 8 h'ffffd911 8 control0h ? 16 h'ffffd920 16, 32 control0l ? 16 h'ffffd922 16 lafmh ? 16 h'ffffd924 16, 32 lafml ? 16 h'ffffd926 16 msg_data[0] ? 8 h'ffffd928 8, 16, 32 msg_data[1] ? 8 h'ffffd929 8 msg_data[2] ? 8 h'ffffd92a 8, 16 msg_data[3] ? 8 h'ffffd92b 8 msg_data[4] ? 8 h'ffffd92c 8, 16, 32 msg_data[5] ? 8 h'ffffd92d 8 msg_data[6] ? 8 h'ffffd92e 8, 16 msg_data[7] ? 8 h'ffffd92f 8 mb[1]. control1h ? 8 h'ffffd930 rcan-et (channel 0) 8, 16 p (reference clock) b: 2 w: 2 l: 4 16 bits control1l ? 8 h'ffffd931 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 965 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffd940 16, 32 control0l ? 16 h'ffffd942 16 lafmh ? 16 h'ffffd944 16, 32 lafml ? 16 h'ffffd946 16 msg_data[0] ? 8 h'ffffd948 8, 16, 32 msg_data[1] ? 8 h'ffffd949 8 msg_data[2] ? 8 h'ffffd94a 8, 16 msg_data[3] ? 8 h'ffffd94b 8 msg_data[4] ? 8 h'ffffd94c 8, 16, 32 msg_data[5] ? 8 h'ffffd94d 8 msg_data[6] ? 8 h'ffffd94e 8, 16 msg_data[7] ? 8 h'ffffd94f 8 control1h ? 8 h'ffffd950 8, 16 mb[2]. control1l ? 8 h'ffffd951 8 control0h ? 16 h'ffffd960 16, 32 control0l ? 16 h'ffffd962 16 lafmh ? 16 h'ffffd964 16, 32 lafml ? 16 h'ffffd966 16 msg_data[0] ? 8 h'ffffd968 8, 16, 32 msg_data[1] ? 8 h'ffffd969 8 msg_data[2] ? 8 h'ffffd96a 8, 16 msg_data[3] ? 8 h'ffffd96b 8 msg_data[4] ? 8 h'ffffd96c 8, 16, 32 msg_data[5] ? 8 h'ffffd96d 8 msg_data[6] ? 8 h'ffffd96e 8, 16 msg_data[7] ? 8 h'ffffd96f 8 control1h ? 8 h'ffffd970 8, 16 mb[3]. control1l ? 8 h'ffffd971 8 control0h ? 16 h'ffffd980 16, 32 mb[4]. control0l ? 16 h'ffffd982 rcan-et (channel 0) 16 p (reference clock) b: 2 w: 2 l: 4 16 bits lafmh ? 16 h'ffffd984 16, 32
section 24 list of registers rev. 3.00 oct. 06, 2008 page 966 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width lafml ? 16 h'ffffd986 16 msg_data[0] ? 8 h'ffffd988 8, 16, 32 msg_data[1] ? 8 h'ffffd989 8 msg_data[2] ? 8 h'ffffd98a 8, 16 msg_data[3] ? 8 h'ffffd98b 8 msg_data[4] ? 8 h'ffffd98c 8, 16, 32 msg_data[5] ? 8 h'ffffd98d 8 msg_data[6] ? 8 h'ffffd98e 8, 16 msg_data[7] ? 8 h'ffffd98f 8 control1h ? 8 h'ffffd990 8, 16 mb[4]. control1l ? 8 h'ffffd991 8 control0h ? 16 h'ffffd9a0 16, 32 control0l ? 16 h'ffffd9a2 16 lafmh ? 16 h'ffffd9a4 16, 32 lafml ? 16 h'ffffd9a6 16 msg_data[0] ? 8 h'ffffd9a8 8, 16, 32 msg_data[1] ? 8 h'ffffd9a9 8 msg_data[2] ? 8 h'ffffd9aa 8, 16 msg_data[3] ? 8 h'ffffd9ab 8 msg_data[4] ? 8 h'ffffd9ac 8, 16, 32 msg_data[5] ? 8 h'ffffd9ad 8 msg_data[6] ? 8 h'ffffd9ae 8, 16 msg_data[7] ? 8 h'ffffd9af 8 control1h ? 8 h'ffffd9b0 8, 16 mb[5]. control1l ? 8 h'ffffd9b1 8 control0h ? 16 h'ffffd9c0 16, 32 control0l ? 16 h'ffffd9c2 16 lafmh ? 16 h'ffffd9c4 16, 32 lafml ? 16 h'ffffd9c6 16 mb[6]. msg_data[0] ? 8 h'ffffd9c8 rcan-et (channel 0) 8, 16, 32 p (reference clock) b: 2 w: 2 l: 4 16 bits msg_data[1] ? 8 h'ffffd9c9 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 967 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width msg_data[2] ? 8 h'ffffd9ca 8, 16 msg_data[3] ? 8 h'ffffd9cb 8 msg_data[4] ? 8 h'ffffd9cc 8, 16, 32 msg_data[5] ? 8 h'ffffd9cd 8 msg_data[6] ? 8 h'ffffd9ce 8, 16 msg_data[7] ? 8 h'ffffd9cf 8 control1h ? 8 h'ffffd9d0 8, 16 mb[6]. control1l ? 8 h'ffffd9d1 8 control0h ? 16 h'ffffd9e0 16, 32 control0l ? 16 h'ffffd9e2 16 lafmh ? 16 h'ffffd9e4 16, 32 lafml ? 16 h'ffffd9e6 16 msg_data[0] ? 8 h'ffffd9e8 8, 16, 32 msg_data[1] ? 8 h'ffffd9e9 8 msg_data[2] ? 8 h'ffffd9ea 8, 16 msg_data[3] ? 8 h'ffffd9eb 8 msg_data[4] ? 8 h'ffffd9ec 8, 16, 32 msg_data[5] ? 8 h'ffffd9ed 8 msg_data[6] ? 8 h'ffffd9ee 8, 16 msg_data[7] ? 8 h'ffffd9ef 8 control1h ? 8 h'ffffd9f0 8, 16 mb[7]. control1l ? 8 h'ffffd9f1 8 control0h ? 16 h'ffffda00 16, 32 control0l ? 16 h'ffffda02 16 lafmh ? 16 h'ffffda04 16, 32 lafml ? 16 h'ffffda06 16 msg_data[0] ? 8 h'ffffda08 8, 16, 32 msg_data[1] ? 8 h'ffffda09 8 msg_data[2] ? 8 h'ffffda0a 8, 16 mb[8]. msg_data[3] ? 8 h'ffffda0b rcan-et (channel 0) 8 p (reference clock) b: 2 w: 2 l: 4 16 bits msg_data[4] ? 8 h'ffffda0c 8, 16, 32
section 24 list of registers rev. 3.00 oct. 06, 2008 page 968 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width msg_data[5] ? 8 h'ffffda0d 8 msg_data[6] ? 8 h'ffffda0e 8, 16 msg_data[7] ? 8 h'ffffda0f 8 control1h ? 8 h'ffffda10 8, 16 mb[8]. control1l ? 8 h'ffffda11 8 control0h ? 16 h'ffffda20 16, 32 control0l ? 16 h'ffffda22 16 lafmh ? 16 h'ffffda24 16, 32 lafml ? 16 h'ffffda26 16 msg_data[0] ? 8 h'ffffda28 8, 16, 32 msg_data[1] ? 8 h'ffffda29 8 msg_data[2] ? 8 h'ffffda2a 8, 16 msg_data[3] ? 8 h'ffffda2b 8 msg_data[4] ? 8 h'ffffda2c 8, 16, 32 msg_data[5] ? 8 h'ffffda2d 8 msg_data[6] ? 8 h'ffffda2e 8, 16 msg_data[7] ? 8 h'ffffda2f 8 control1h ? 8 h'ffffda30 8, 16 mb[9]. control1l ? 8 h'ffffda31 8 control0h ? 16 h'ffffda40 16, 32 control0l ? 16 h'ffffda42 16 lafmh ? 16 h'ffffda44 16, 32 lafml ? 16 h'ffffda46 16 msg_data[0] ? 8 h'ffffda48 8, 16, 32 msg_data[1] ? 8 h'ffffda49 8 msg_data[2] ? 8 h'ffffda4a 8, 16 msg_data[3] ? 8 h'ffffda4b 8 msg_data[4] ? 8 h'ffffda4c 8, 16, 32 msg_data[5] ? 8 h'ffffda4d 8 mb[10]. msg_data[6] ? 8 h'ffffda4e rcan-et (channel 0) 8, 16 p (reference clock) b: 2 w: 2 l: 4 16 bits msg_data[7] ? 8 h'ffffda4f 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 969 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control1h ? 8 h'ffffda50 8, 16 mb[10]. control1l ? 8 h'ffffda51 8 control0h ? 16 h'ffffda60 16, 32 control0l ? 16 h'ffffda62 16 lafmh ? 16 h'ffffda64 16, 32 lafml ? 16 h'ffffda66 16 msg_data[0] ? 8 h'ffffda68 8, 16, 32 msg_data[1] ? 8 h'ffffda69 8 msg_data[2] ? 8 h'ffffda6a 8, 16 msg_data[3] ? 8 h'ffffda6b 8 msg_data[4] ? 8 h'ffffda6c 8, 16, 32 msg_data[5] ? 8 h'ffffda6d 8 msg_data[6] ? 8 h'ffffda6e 8, 16 msg_data[7] ? 8 h'ffffda6f 8 control1h ? 8 h'ffffda70 8, 16 mb[11]. control1l ? 8 h'ffffda71 8 control0h ? 16 h'ffffda80 16, 32 control0l ? 16 h'ffffda82 16 lafmh ? 16 h'ffffda84 16, 32 lafml ? 16 h'ffffda86 16 msg_data[0] ? 8 h'ffffda88 8, 16, 32 msg_data[1] ? 8 h'ffffda89 8 msg_data[2] ? 8 h'ffffda8a 8, 16 msg_data[3] ? 8 h'ffffda8b 8 msg_data[4] ? 8 h'ffffda8c 8, 16, 32 msg_data[5] ? 8 h'ffffda8d 8 msg_data[6] ? 8 h'ffffda8e 8, 16 msg_data[7] ? 8 h'ffffda8f 8 mb[12]. control1h ? 8 h'ffffda90 rcan-et (channel 0) 8, 16 p (reference clock) b: 2 w: 2 l: 4 16 bits control1l ? 8 h'ffffda91 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 970 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffdaa0 16, 32 control0l ? 16 h'ffffdaa2 16 lafmh ? 16 h'ffffdaa4 16, 32 lafml ? 16 h'ffffdaa6 16 msg_data[0] ? 8 h'ffffdaa8 8, 16, 32 msg_data[1] ? 8 h'ffffdaa9 8 msg_data[2] ? 8 h'ffffdaaa 8, 16 msg_data[3] ? 8 h'ffffdaab 8 msg_data[4] ? 8 h'ffffdaac 8, 16, 32 msg_data[5] ? 8 h'ffffdaad 8 msg_data[6] ? 8 h'ffffdaae 8, 16 msg_data[7] ? 8 h'ffffdaaf 8 control1h ? 8 h'ffffdab0 8, 16 mb[13]. control1l ? 8 h'ffffdab1 8 control0h ? 16 h'ffffdac0 16, 32 control0l ? 16 h'ffffdac2 16 lafmh ? 16 h'ffffdac4 16, 32 lafml ? 16 h'ffffdac6 16 msg_data[0] ? 8 h'ffffdac8 8, 16, 32 msg_data[1] ? 8 h'ffffdac9 8 msg_data[2] ? 8 h'ffffdaca 8, 16 msg_data[3] ? 8 h'ffffdacb 8 msg_data[4] ? 8 h'ffffdacc 8, 16, 32 msg_data[5] ? 8 h'ffffdacd 8 msg_data[6] ? 8 h'ffffdace 8, 16 msg_data[7] ? 8 h'ffffdacf 8 control1h ? 8 h'ffffdad0 8, 16 mb[14]. control1l ? 8 h'ffffdad1 8 control0h ? 16 h'ffffdae0 16, 32 mb[15]. control0l ? 16 h'ffffdae2 rcan-et (channel 0) 16 p (reference clock) b: 2 w: 2 l: 4 16 bits lafmh ? 16 h'ffffdae4 16, 32
section 24 list of registers rev. 3.00 oct. 06, 2008 page 971 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width lafml ? 16 h'ffffdae6 16 msg_data[0] ? 8 h'ffffdae8 8, 16, 32 msg_data[1] ? 8 h'ffffdae9 8 msg_data[2] ? 8 h'ffffdaea 8, 16 msg_data[3] ? 8 h'ffffdaeb 8 msg_data[4] ? 8 h'ffffdaec 8, 16, 32 msg_data[5] ? 8 h'ffffdaed 8 msg_data[6] ? 8 h'ffffdaee 8, 16 msg_data[7] ? 8 h'ffffdaef 8 control1h ? 8 h'ffffdaf0 8, 16 mb[15]. control1l ? 8 h'ffffdaf1 rcan-et (channel 0) 8 p (reference clock) b: 2 w: 2 l: 4 16 bits master control register_1 mcr_1 16 h'ffffe000 16 general status register_1 gsr_1 16 h'ffffe002 16 bit configuration register 1_1 bcr1_1 16 h'ffffe004 16 bit configuration register 0_1 bcr0_1 16 h'ffffe006 16 interrupt request register_1 irr_1 16 h'ffffe008 16 interrupt mask register_1 imr_1 16 h'ffffe00a 16 transmit error counter_1/ receive error counter_1 tec_1/rec_1 16 h'ffffe00c 16 transmit wait register 1_1, transmit wait register 0_1 txpr1_1, txpr 0_1 32 h'ffffe020 32 transmit cancel register 0_1 txcr0_1 16 h'ffffe02a 16 transmit acknowledge register 0_1 txack0_1 16 h'ffffe032 16 abort acknowledge register 0_1 aback 0_1 16 h'ffffe03a 16 receive end register 0_1 rxpr0_1 16 h'ffffe042 16 remote frame request register 0_1 rfpr0_1 16 h'ffffe04a 16 mailbox interrupt mask register 0_1 mbimr0_1 16 h'ffffe052 rcan-et (channel 1) * 1 16 p (reference clock) b: 2 w: 2 l: 4 16 bits unread message status register 0_1 umsr0_1 16 h'ffffe05a 16
section 24 list of registers rev. 3.00 oct. 06, 2008 page 972 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffe100 16, 32 control0l ? 16 h'ffffe102 16 lafmh ? 16 h'ffffe104 16, 32 lafml ? 16 h'ffffe106 16 msg_data[0] ? 8 h'ffffe108 8, 16, 32 msg_data[1] ? 8 h'ffffe109 8 msg_data[2] ? 8 h'ffffe10a 8, 16 msg_data[3] ? 8 h'ffffe10b 8 msg_data[4] ? 8 h'ffffe10c 8, 16, 32 msg_data[5] ? 8 h'ffffe10d 8 msg_data[6] ? 8 h'ffffe10e 8, 16 msg_data[7] ? 8 h'ffffe10f 8 control1h ? 8 h'ffffe110 8, 16 mb[0]. control1l ? 8 h'ffffe111 8 control0h ? 16 h'ffffe120 16, 32 control0l ? 16 h'ffffe122 16 lafmh ? 16 h'ffffe124 16, 32 lafml ? 16 h'ffffe126 16 msg_data[0] ? 8 h'ffffe128 8, 16, 32 msg_data[1] ? 8 h'ffffe129 8 msg_data[2] ? 8 h'ffffe12a 8, 16 msg_data[3] ? 8 h'ffffe12b 8 msg_data[4] ? 8 h'ffffe12c 8, 16, 32 msg_data[5] ? 8 h'ffffe12d 8 msg_data[6] ? 8 h'ffffe12e 8, 16 msg_data[7] ? 8 h'ffffe12f 8 mb[1]. control1h ? 8 h'ffffe130 rcan-et (channel 1) * 1 8, 16 p (reference clock) b:2 w:2 l:4 16 bits control1l ? 8 h'ffffe131 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 973 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffe140 16, 32 control0l ? 16 h'ffffe142 16 lafmh ? 16 h'ffffe144 16, 32 lafml ? 16 h'ffffe146 16 msg_data[0] ? 8 h'ffffe148 8, 16, 32 msg_data[1] ? 8 h'ffffe149 8 msg_data[2] ? 8 h'ffffe14a 8, 16 mb[2]. msg_data[3] ? 8 h'ffffe14b 8 msg_data[4] ? 8 h'ffffe14c 8, 16, 32 msg_data[5] ? 8 h'ffffe14d 8 msg_data[6] ? 8 h'ffffe14e 8, 16 msg_data[7] ? 8 h'ffffe14f 8 control1h ? 8 h'ffffe150 8, 16 mb[2]. control1l ? 8 h'ffffe151 8 control0h ? 16 h'ffffe160 16, 32 control0l ? 16 h'ffffe162 16 lafmh ? 16 h'ffffe164 16, 32 lafml ? 16 h'ffffe166 16 msg_data[0] ? 8 h'ffffe168 8, 16, 32 msg_data[1] ? 8 h'ffffe169 8 msg_data[2] ? 8 h'ffffe16a 8, 16 msg_data[3] ? 8 h'ffffe16b 8 msg_data[4] ? 8 h'ffffe16c 8, 16, 32 msg_data[5] ? 8 h'ffffe16d 8 msg_data[6] ? 8 h'ffffe16e 8, 16 msg_data[7] ? 8 h'ffffe16f 8 mb[3]. control1h ? 8 h'ffffe170 rcan-et (channel 1) * 1 8, 16 p (reference clock) b:2 w:2 l:4 16 bits control1l ? 8 h'ffffe171 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 974 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffe180 16, 32 control0l ? 16 h'ffffe182 16 lafmh ? 16 h'ffffe184 16, 32 lafml ? 16 h'ffffe186 16 msg_data[0] ? 8 h'ffffe188 8, 16, 32 msg_data[1] ? 8 h'ffffe189 8 msg_data[2] ? 8 h'ffffe18a 8, 16 msg_data[3] ? 8 h'ffffe18b 8 msg_data[4] ? 8 h'ffffe18c 8, 16, 32 msg_data[5] ? 8 h'ffffe18d 8 msg_data[6] ? 8 h'ffffe18e 8, 16 msg_data[7] ? 8 h'ffffe18f 8 control1h ? 8 h'ffffe190 8, 16 mb[4]. control1l ? 8 h'ffffe191 8 control0h ? 16 h'ffffe1a0 16, 32 control0l ? 16 h'ffffe1a2 16 lafmh ? 16 h'ffffe1a4 16, 32 lafml ? 16 h'ffffe1a6 16 msg_data[0] ? 8 h'ffffe1a8 8, 16, 32 msg_data[1] ? 8 h'ffffe1a9 8 msg_data[2] ? 8 h'ffffe1aa 8, 16 msg_data[3] ? 8 h'ffffe1ab 8 msg_data[4] ? 8 h'ffffe1ac 8, 16, 32 msg_data[5] ? 8 h'ffffe1ad 8 msg_data[6] ? 8 h'ffffe1ae 8, 16 msg_data[7] ? 8 h'ffffe1af 8 mb[5]. control1h ? 8 h'ffffe1b0 rcan-et (channel 1) * 1 8, 16 p (reference clock) b:2 w:2 l:4 16 bits control1l ? 8 h'ffffe1b1 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 975 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffe1c0 16, 32 control0l ? 16 h'ffffe1c2 16 lafmh ? 16 h'ffffe1c4 16, 32 lafml ? 16 h'ffffe1c6 16 msg_data[0] ? 8 h'ffffe1c8 8, 16, 32 msg_data[1] ? 8 h'ffffe1c9 8 msg_data[2] ? 8 h'ffffe1ca 8, 16 msg_data[3] ? 8 h'ffffe1cb 8 msg_data[4] ? 8 h'ffffe1cc 8, 16, 32 msg_data[5] ? 8 h'ffffe1cd 8 msg_data[6] ? 8 h'ffffe1ce 8, 16 msg_data[7] ? 8 h'ffffe1cf 8 control1h ? 8 h'ffffe1d0 8, 16 mb[6]. control1l ? 8 h'ffffe1d1 8 control0h ? 16 h'ffffe1e0 16, 32 control0l ? 16 h'ffffe1e2 16 lafmh ? 16 h'ffffe1e4 16, 32 lafml ? 16 h'ffffe1e6 16 msg_data[0] ? 8 h'ffffe1e8 8, 16, 32 msg_data[1] ? 8 h'ffffe1e9 8 msg_data[2] ? 8 h'ffffe1ea 8, 16 msg_data[3] ? 8 h'ffffe1eb 8 msg_data[4] ? 8 h'ffffe1ec 8, 16, 32 msg_data[5] ? 8 h'ffffe1ed 8 msg_data[6] ? 8 h'ffffe1ee 8, 16 msg_data[7] ? 8 h'ffffe1ef 8 mb[7]. control1h ? 8 h'ffffe1f0 rcan-et (channel 1) * 1 8, 16 p (reference clock) b:2 w:2 l:4 16 bits control1l ? 8 h'ffffe1f1 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 976 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffe200 16, 32 control0l ? 16 h'ffffe202 16 lafmh ? 16 h'ffffe204 16, 32 lafml ? 16 h'ffffe206 16 msg_data[0] ? 8 h'ffffe208 8, 16, 32 msg_data[1] ? 8 h'ffffe209 8 msg_data[2] ? 8 h'ffffe20a 8, 16 msg_data[3] ? 8 h'ffffe20b 8 msg_data[4] ? 8 h'ffffe20c 8, 16, 32 msg_data[5] ? 8 h'ffffe20d 8 msg_data[6] ? 8 h'ffffe20e 8, 16 msg_data[7] ? 8 h'ffffe20f 8 control1h ? 8 h'ffffe210 8, 16 mb[8]. control1l ? 8 h'ffffe211 8 control0h ? 16 h'ffffe220 16, 32 control0l ? 16 h'ffffe222 16 lafmh ? 16 h'ffffe224 16, 32 lafml ? 16 h'ffffe226 16 msg_data[0] ? 8 h'ffffe228 8, 16, 32 msg_data[1] ? 8 h'ffffe229 8 msg_data[2] ? 8 h'ffffe22a 8, 16 msg_data[3] ? 8 h'ffffe22b 8 msg_data[4] ? 8 h'ffffe22c 8, 16, 32 msg_data[5] ? 8 h'ffffe22d 8 msg_data[6] ? 8 h'ffffe22e 8, 16 msg_data[7] ? 8 h'ffffe22f 8 mb[9]. control1h ? 8 h'ffffe230 rcan-et (channel 1) * 1 8, 16 p (reference clock) b:2 w:2 l:4 16 bits control1l ? 8 h'ffffe231 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 977 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffe240 16, 32 control0l ? 16 h'ffffe242 16 lafmh ? 16 h'ffffe244 16, 32 lafml ? 16 h'ffffe246 16 msg_data[0] ? 8 h'ffffe248 8, 16, 32 msg_data[1] ? 8 h'ffffe249 8 msg_data[2] ? 8 h'ffffe24a 8, 16 msg_data[3] ? 8 h'ffffe24b 8 msg_data[4] ? 8 h'ffffe24c 8, 16, 32 msg_data[5] ? 8 h'ffffe24d 8 msg_data[6] ? 8 h'ffffe24e 8, 16 msg_data[7] ? 8 h'ffffe24f 8 control1h ? 8 h'ffffe250 8, 16 mb[10]. control1l ? 8 h'ffffe251 8 control0h ? 16 h'ffffe260 16, 32 control0l ? 16 h'ffffe262 16 lafmh ? 16 h'ffffe264 16, 32 lafml ? 16 h'ffffe266 16 msg_data[0] ? 8 h'ffffe268 8, 16, 32 msg_data[1] ? 8 h'ffffe269 8 msg_data[2] ? 8 h'ffffe26a 8, 16 msg_data[3] ? 8 h'ffffe26b 8 msg_data[4] ? 8 h'ffffe26c 8, 16, 32 msg_data[5] ? 8 h'ffffe26d 8 msg_data[6] ? 8 h'ffffe26e 8, 16 msg_data[7] ? 8 h'ffffe26f 8 mb[11]. control1h ? 8 h'ffffe270 rcan-et (channel 1) * 1 8, 16 p (reference clock) b:2 w:2 l:4 16 bits control1l ? 8 h'ffffe271 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 978 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffe280 16, 32 control0l ? 16 h'ffffe282 16 lafmh ? 16 h'ffffe284 16, 32 lafml ? 16 h'ffffe286 16 msg_data[0] ? 8 h'ffffe288 8, 16, 32 msg_data[1] ? 8 h'ffffe289 8 msg_data[2] ? 8 h'ffffe28a 8, 16 msg_data[3] ? 8 h'ffffe28b 8 msg_data[4] ? 8 h'ffffe28c 8, 16, 32 msg_data[5] ? 8 h'ffffe28d 8 msg_data[6] ? 8 h'ffffe28e 8, 16 msg_data[7] ? 8 h'ffffe28f 8 control1h ? 8 h'ffffe290 8, 16 mb[12]. control1l ? 8 h'ffffe291 8 control0h ? 16 h'ffffe2a0 16, 32 control0l ? 16 h'ffffe2a2 16 lafmh ? 16 h'ffffe2a4 16, 32 lafml ? 16 h'ffffe2a6 16 msg_data[0] ? 8 h'ffffe2a8 8, 16, 32 msg_data[1] ? 8 h'ffffe2a9 8 msg_data[2] ? 8 h'ffffe2aa 8, 16 msg_data[3] ? 8 h'ffffe2ab 8 msg_data[4] ? 8 h'ffffe2ac 8, 16, 32 msg_data[5] ? 8 h'ffffe2ad 8 msg_data[6] ? 8 h'ffffe2ae 8, 16 msg_data[7] ? 8 h'ffffe2af 8 mb[13]. control1h ? 8 h'ffffe2b0 rcan-et (channel 1) * 1 8, 16 p (reference clock) b:2 w:2 l:4 16 bits control1l ? 8 h'ffffe2b1 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 979 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width control0h ? 16 h'ffffe2c0 16, 32 control0l ? 16 h'ffffe2c2 16 lafmh ? 16 h'ffffe2c4 16, 32 lafml ? 16 h'ffffe2c6 16 msg_data[0] ? 8 h'ffffe2c8 8, 16, 32 msg_data[1] ? 8 h'ffffe2c9 8 msg_data[2] ? 8 h'ffffe2ca 8, 16 msg_data[3] ? 8 h'ffffe2cb 8 msg_data[4] ? 8 h'ffffe2cc 8, 16, 32 msg_data[5] ? 8 h'ffffe2cd 8 msg_data[6] ? 8 h'ffffe2ce 8, 16 msg_data[7] ? 8 h'ffffe2cf 8 control1h ? 8 h'ffffe2d0 8, 16 mb[14]. control1l ? 8 h'ffffe2d1 8 control0h ? 16 h'ffffe2e0 16, 32 control0l ? 16 h'ffffe2e2 16 lafmh ? 16 h'ffffe2e4 16, 32 lafml ? 16 h'ffffe2e6 16 msg_data[0] ? 8 h'ffffe2e8 8, 16, 32 msg_data[1] ? 8 h'ffffe2e9 8 msg_data[2] ? 8 h'ffffe2ea 8, 16 msg_data[3] ? 8 h'ffffe2eb 8 msg_data[4] ? 8 h'ffffe2ec 8, 16, 32 msg_data[5] ? 8 h'ffffe2ed 8 msg_data[6] ? 8 h'ffffe2ee 8, 16 msg_data[7] ? 8 h'ffffe2ef 8 mb[15]. control1h ? 8 h'ffffe2f0 rcan-et (channel 1) * 1 8, 16 p (reference clock) b:2 w:2 l:4 16 bits control1l ? 8 h'ffffe2f1 8
section 24 list of registers rev. 3.00 oct. 06, 2008 page 980 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width frequency control register frqcr 16 h'ffffe800 cpg 16 p (reference clock) w: 2 16 bits standby control register 1 stbcr1 8 h'ffffe802 8 standby control register 2 stbcr2 8 h'ffffe804 power-down modes 8 standby control register 3 stbcr3 8 h'ffffe806 8 standby control register 4 stbcr4 8 h'ffffe808 8 standby control register 5 stbcr5 8 h'ffffe80a 8 standby control register 6 stbcr6 8 h'ffffe80c 8 p (reference clock) b: 2 16 bits watchdog timer counter wtcnt 8 h'ffffe810 8 * 2 , 16 * 3 watchdog timer control/status register wtcsr 8 h'ffffe812 wdt 8 * 2 , 16 * 3 p (reference clock) b: 2 * 2 w: 2 * 3 16 bits oscillation stop detection control register osccr 8 h'ffffe814 cpg 8 p (reference clock) b: 2 16 bits ram control register ramcr 8 h'ffffe880 power-down modes 8 p (reference clock) b: 2 16 bits bus function extending register bscehr 16 h'ffffe89a bsc 8, 16 p (reference clock) b: 2 w: 2 16 bits interrupt control register 0 icr0 16 h'ffffe900 intc 8, 16 irq control register irqcr 16 h'ffffe902 8, 16 irq status register irqsr 16 h'ffffe904 8, 16 interrupt priority register a ipra 16 h'ffffe906 8, 16 interrupt priority register d iprd 16 h'ffffe982 16 interrupt priority register e ipre 16 h'ffffe984 16 interrupt priority register f iprf 16 h'ffffe986 16 interrupt priority register h iprh 16 h'ffffe98a 16 interrupt priority register i ipri 16 h'ffffe98c 16 interrupt priority register j iprj 16 h'ffffe98e 16 interrupt priority register k iprk 16 h'ffffe990 16 interrupt priority register l iprl 16 h'ffffe992 16 p (reference clock) b: 2 w: 2 16 bits interrupt priority register m iprm 16 h'ffffe994 16
section 24 list of registers rev. 3.00 oct. 06, 2008 page 981 of 1080 rej09b0230-0300 register name abbreviation no. of bits address module access size no. of access cycles connected bus width common control register cmncr 32 h'fffff000 bsc 32 cs0 space bus control register cs0bcr 32 h'fffff004 32 cs1 space bus control register cs1bcr 32 h'fffff008 32 cs0 space wait control register cs0wcr 32 h'fffff028 32 cs1 space wait control register cs1wcr 32 h'fffff02c 32 b (reference clock) l: 2 16 bits ram emulation register ramer 16 h'fffff108 flash 16 b (reference clock) w: 2 16 bits break address register a bara 32 h'fffff300 ubc 32 break address mask register a bamra 32 h'fffff304 32 break bus cycle register a bbra 16 h'fffff308 16 break data register a bdra 32 h'fffff310 32 break data mask register a bdmra 32 h'fffff314 32 break address register b barb 32 h'fffff320 32 break address mask register b bamrb 32 h'fffff324 32 break bus cycle register b bbrb 16 h'fffff328 16 break data register b bdrb 32 h'fffff330 32 break data mask register b bdmrb 32 h'fffff334 32 b (reference clock) b: 2 w: 2 l: 2 16 bits break control register brcr 32 h'fffff3c0 ubc 32 branch source register brsr 32 h'fffff3d0 32 branch destination register brdr 32 h'fffff3d4 32 execution times break register betr 16 h'fffff3dc 16 i (reference clock) b: 2 w: 2 l: 2 16 bits aud control register aucsr 32 h'fffff400 aud 32 aud window a start address register auwasr 32 h'fffff404 32 aud window a end address register auwaer 32 h'fffff408 32 aud window b start address register auwbsr 32 h'fffff40c 32 aud window b end address register auwber 32 h'fffff410 32 b (reference clock) l: 2 16 bits aud extended control register auecsr 32 h'fffff414 32 notes: 1. available only in the sh7142. 2. at read operation. 3. at write operation.
section 24 list of registers rev. 3.00 oct. 06, 2008 page 982 of 1080 rej09b0230-0300 24.2 register bit list addresses and bit names of each on-chip peripheral module are shown below. as for 16-bit or 32-bit registers, they are shown in two or four rows. register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module scsmr_0 c/ a chr pe o/ e stop mp cks[1:0] scbrr_0 scscr_0 tie rie te re mpie teie cke[1:0] sctdr_0 scssr_0 tdre rdrf orer fer per tend mpb mpbt sci (channel 0) scrdr_0 scsdcr_0 ? ? ? ? dir ? ? ? scsptr_0 eio ? ? ? spb1io spb1dt spb0io spb0dt scsmr_1 c/ a chr pe o/ e stop mp cks[1:0] scbrr_1 scscr_1 tie rie te re mpie teie cke[1:0] sctdr_1 scssr_1 tdre rdrf orer fer per tend mpb mpbt sci (channel 1) scrdr_1 scsdcr_1 ? ? ? ? dir ? ? ? scsptr_1 eio ? ? ? spb1io spb1dt spb0io spb0dt scsmr_2 c/ a chr pe o/ e stop mp cks[1:0] scbrr_2 scscr_2 tie rie te re mpie teie cke[1:0] sctdr_2 scssr_2 tdre rdrf orer fer per tend mpb mpbt sci (channel 2) scrdr_2 scsdcr_2 ? ? ? ? dir ? ? ? scsptr_2 eio ? ? ? spb1io spb1dt spb0io spb0dt
section 24 list of registers rev. 3.00 oct. 06, 2008 page 983 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module tcr_3 cclr[2:0] ckeg[1:0] tpsc[2:0] tcr_4 cclr[2:0] ckeg[1:0] tpsc[2:0] tmdr_3 ? ? bfb bfa md[3:0] tmdr_4 ? ? bfb bfa md[3:0] mtu2 tiorh_3 iob[3:0] ioa[3:0] tiorl_3 iod[3:0] ioc[3:0] tiorh_4 iob[3:0] ioa[3:0] tiorl_4 iod[3:0] ioc[3:0] tier_3 ttge ? ? tciev tgied tgiec tgieb tgiea tier_4 ttge ttge2 ? tciev tgied tgiec tgieb tgiea toer ? ? oe4d oe4c oe3d oe4b oe4a oe3b tgcr ? bdc n p fb wf vf uf tocr1 ? psye ? ? tocl tocs olsn olsp tocr2 bf[1:0] ols3n ols3p ols2n ols2p ols1n ols1p tcnt_3 tcnt_4 tcdr tddr tgra_3 tgrb_3 tgra_4 tgrb_4
section 24 list of registers rev. 3.00 oct. 06, 2008 page 984 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module mtu2 tcnts tcbr tgrc_3 tgrd_3 tgrc_4 tgrd_4 tsr_3 tcfd ? ? tcfv tgfd tgfc tgfb tgfa tsr_4 tcfd ? ? tcfv tgfd tgfc tgfb tgfa titcr t3aen 3acor[2:0] t4ven 4vcor[2:0] titcnt ? 3acnt[2:0] ? 4vcnt[2:0] tbter ? ? ? ? ? ? bte[1:0] tder ? ? ? ? ? ? ? tder tolbr ? ? ols3n ols3p ols2n ols2p ols1n ols1p tbtm_3 ? ? ? ? ? ? ttsb ttsa tbtm_4 ? ? ? ? ? ? ttsb ttsa bf[1:0] ? ? ? ? ? ? tadcr ut4ae dt4ae ut4be dt4be ita3ae ita4ve itb3ae itb4ve tadcora_4 tadcorb_4 tadcobra_4 tadcobrb_4
section 24 list of registers rev. 3.00 oct. 06, 2008 page 985 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module twcr cce ? ? ? ? ? ? wre tstr cst4 cst3 ? ? ? cst2 cst1 cst0 tsyr sync4 sync3 ? ? ? sync2 sync1 sync0 tcsystr sch0 sch1 sch2 sch3 sch4 ? sch3s sch4s trwer ? ? ? ? ? ? ? rwe mtu2 tcr_0 cclr[2:0] ckeg[1:0] tpsc[2:0] tmdr_0 ? bfe bfb bfa md[3:0] tiorh_0 iob[3:0] ioa[3:0] tiorl_0 iod[3:0] ioc[3:0] tier_0 ttge ? ? tciev tgied tgiec tgieb tgiea tsr_0 ? ? ? tcfv tgfd tgfc tgfb tgfa tcnt_0 tgra_0 tgrb_0 tgrc_0 tgrd_0 tgre_0 tgrf_0 tier2_0 ttge2 ? ? ? ? ? tgief tgiee tsr2_0 ? ? ? ? ? ? tgff tgfe tbtm_0 ? ? ? ? ? ttse ttsb ttsa tcr_1 ? cclr[1:0] ckeg[1:0] tpsc[2:0] tmdr_1 ? ? ? ? md[3:0] tior_1 iob[3:0] ioa[3:0]
section 24 list of registers rev. 3.00 oct. 06, 2008 page 986 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module tier_1 ttge ? tcieu tciev ? ? tgieb tgiea tsr_1 tcfd ? tcfu tcfv ? ? tgfb tgfa tcnt_1 tgra_1 tgrb_1 mtu2 ticcr ? ? ? ? i2be i2ae i1be i1ae tcr_2 ? cclr[1:0] ckeg[1:0] tpsc[2:0] tmdr_2 ? ? ? ? md[3:0] tior_2 iob[3:0] ioa[3:0] tier_2 ttge ? tcieu tciev ? ? tgieb tgiea tsr_2 tcfd ? tcfu tcfv ? ? tgfb tgfa tcnt_2 tgra_2 tgrb_2 tcr_3s cclr[2:0] ckeg[1:0] tpsc[2:0] mtu2s tcr_4s cclr[2:0] ckeg[1:0] tpsc[2:0] tmdr_3s ? ? bfb bfa md[3:0] tmdr_4s ? ? bfb bfa md[3:0] tiorh_3s iob[3:0] ioa[3:0] tiorl_3s iod[3:0] ioc[3:0] tiorh_4s iob[3:0] ioa[3:0] tiorl_4s iod[3:0] ioc[3:0] tier_3s ttge ? ? tciev tgied tgiec tgieb tgiea tier_4s ttge ttge2 ? tciev tgied tgiec tgieb tgiea
section 24 list of registers rev. 3.00 oct. 06, 2008 page 987 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module toers ? ? oe4d oe4c oe3d oe4b oe4a oe3b mtu2s tgcrs ? bdc n p fb wf vf uf tocr1s ? psye ? ? tocl tocs olsn olsp tocr2s bf[1:0] ols3n ols3p ols2n ols2p ols1n ols1p tcnt_3s tcnt_4s tcdrs tddrs tgra_3s tgrb_3s tgra_4s tgrb_4s tcntss tcbrs tgrc_3s tgrd_3s tgrc_4s
section 24 list of registers rev. 3.00 oct. 06, 2008 page 988 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module tgrd_4s mtu2s tsr_3s tcfd ? ? tcfv tgfd tgfc tgfb tgfa tsr_4s tcfd ? ? tcfv tgfd tgfc tgfb tgfa titcrs t3aen 3acor[2:0] t4ven 4vcor[2:0] titcnts ? 3acnt[2:0] ? 4vcnt[2:0] tbters ? ? ? ? ? ? bte[1:0] tders ? ? ? ? ? ? ? tder tolbrs ? ? ols3n ols3p ols2n ols2p ols1n ols1p tbtm_3s ? ? ? ? ? ? ttsb ttsa tbtm_4s ? ? ? ? ? ? ttsb ttsa bf[1:0] ? ? ? ? ? ? tadcrs ut4ae dt4ae ut4be dt4be ita3ae ita4ve itb3ae itb4ve tadcora_4s tadcorb_4s tadcobra_4s tadcobrb_4s tsycrs ce0a ce0b ce0c ce0d ce1a ce1b ce2a ce2b twcrs cce ? ? ? ? ? scc wre tstrs cst4 cst3 ? ? ? cst2 cst1 cst0 tsyrs sync4 sync3 ? ? ? sync2 sync1 sync0 trwers ? ? ? ? ? ? ? rwe tcntu_5s tgru_5s tcru_5s ? ? ? ? ? ? tpsc[1:0]
section 24 list of registers rev. 3.00 oct. 06, 2008 page 989 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module tioru_5s ? ? ? ioc[4:0] mtu2s tcntv_5s tgrv_5s tcrv_5s ? ? ? ? ? ? tpsc[1:0] tiorv_5s ? ? ? ioc[4:0] tcntw_5s tgrw_5s tcrw_5s ? ? ? ? ? ? tpsc[1:0] tiorw_5s ? ? ? ioc[4:0] tsr_5s ? ? ? ? ? cmfu5 cmfv5 cmfw5 tier_5s ? ? ? ? ? tgie5u tgie5v tgie5w tstr_5s ? ? ? ? ? cstu5 cstv5 cstw5 tcntcmpclrs ? ? ? ? ? cmpclr5u cmpclr5v cmpclr5w fccs fwe mat ? fler ? ? ? sco flash fpcs ? ? ? ? ? ? ? ppvs fecs ? ? ? ? ? ? ? epvb fkey k[7:0] fmats ms7 ms6 ms5 ms4 ms3 ms2 ms1 ms0 ftdar tder tda[6:0] dtcera15 dtcera14 dtcera13 dtcera12 ? ? ? ? dtcera ? ? ? ? ? ? ? ? dtc dtcerb15 dtcerb14 dtcerb 13 dtcerb12 dtcerb11 dtce rb10 dtcerb9 dtcerb8 dtcerb dtcerb7 dtcerb6 dtcerb 5 dtcerb4 dtcerb3 dtce rb2 dtcerb1 dtcerb0 dtcerc15 ? ? ? ? ? ? ? dtcerc ? ? ? ? dtcerc3 dtcerc2 dtcerc1 dtcerc0 dtcerd15 dtcerd14 dtcerd13 dtcerd12 d tcerd11 dtcerd10 dtcerd9 dtcerd8 dtcerd dtcerd7 dtcerd6 ? ? ? dtcerd2 dtcerd1 ?
section 24 list of registers rev. 3.00 oct. 06, 2008 page 990 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module dtcere15 dtcere14 dtcere13 dtcere12 dtcere11 dtcere10 ? ? dtcere dtcere7 dtcere6 ? ? dtcere3 ? ? ? dtc dtccr ? ? ? rrs rchne ? ? err ? ? ? ? dtcvbr ? ? ? ? ? ? ? ? sscrh mss bide ? sol solp ? css[1:0] sscrl fclrm ssums sres ? ? ? dats[1:0] ssmr mls cpos cphs ? ? cks[2:0] sser te re ? ? teie tie rie ceie sssr ? orer ? ? tend tdre rdrf ce sscr2 ? ? ? tendsts scsats ssodts ? ? sstdr0 sstdr1 sstdr2 sstdr3 ssrdr0 ssrdr1 ssrdr2 ssrdr3 synchronous serial communication unit ? ? ? ? ? ? ? ? cmt cmstr ? ? ? ? ? ? str1 str0 ? ? ? ? ? ? ? ? cmcsr_0 cmf cmie ? ? ? ? cks[1:0] cmcnt_0 cmcor_0 ? ? ? ? ? ? ? ? cmcsr_1 cmf cmie ? ? ? ? cks[1:0]
section 24 list of registers rev. 3.00 oct. 06, 2008 page 991 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module cmt cmcnt_1 cmcor_1 ? poe2f poe1f poe0f ? ? ? pie1 poe icsr1 ? ? poe2m[1:0] poe1m[1:0] poe0m[1:0] osf1 ? ? ? ? ? oce1 oie1 ocsr1 ? ? ? ? ? ? ? ? ? poe6f poe5f poe4f ? ? ? pie2 icsr2 ? ? poe6m[1:0] poe5m[1:0] poe4m[1:0] osf2 ? ? ? ? ? oce2 oie2 ocsr2 ? ? ? ? ? ? ? ? ? ? ? poe8f ? ? poe8e pie3 icsr3 ? ? ? ? ? ? poe8m[1:0] spoer ? ? ? ? ? mtu2shiz mtu2ch0hiz mtu2ch34hiz poecr1 ? ? ? ? mtu2pe3ze mtu2pe2ze mtu2pe1ze mtu2pe0ze ? mtu2p1cze mtu2p2cze mtu2p3cze ? mtu2sp1cze mtu2sp2cze mtu2sp3cze poecr2 ? ? ? ? ? ? ? ? pa15dr pa14dr pa13dr pa12dr pa11dr pa10dr pa9dr pa8dr i/o padrl pa7dr pa6dr pa5dr pa4dr pa3dr pa2dr pa1dr pa0dr pa15ior pa14ior pa13ior pa12ior pa11ior pa10ior pa9ior pa8ior pfc paiorl pa7ior pa6ior pa5ior pa4ior pa3ior pa2ior pa1ior pa0ior ? pa15md2 pa15md1 pa15md0 ? pa14md2 pa14md1 pa14md0 pacrl4 ? pa13md2 pa13md1 pa13md0 ? pa12md2 pa12md1 pa12md0 ? pa11md2 pa11md1 pa11md0 ? pa10md2 pa10md1 pa10md0 pacrl3 ? pa9md2 pa9md1 pa9md0 ? pa8md2 pa8md1 pa8md0 ? pa7md2 pa7md1 pa7md0 ? pa6md2 pa6md1 pa6md0 pacrl2 ? pa5md2 pa5md1 pa5md0 ? pa4md2 pa4md1 pa4md0 ? pa3md2 pa3md1 pa3md0 ? pa2md2 pa2md1 pa2md0 pacrl1 ? pa1md2 pa1md1 pa1md0 ? pa0md2 pa0md1 pa0md0
section 24 list of registers rev. 3.00 oct. 06, 2008 page 992 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module pa15pr pa14pr pa13pr pa12pr pa11pr pa10pr pa9pr pa8pr i/o paprl pa7pr pa6pr pa5pr pa4pr pa3 pr pa2pr pa1pr pa0pr ? ? ? ? ? ? ? ? pbdrl pb7dr pb6dr pb5dr pb4dr pb3dr pb2dr pb1dr pb0dr ? ? ? ? ? ? ? ? pfc pbiorl pb7ior pb6ior pb5ior pb4ior pb3ior pb2ior pb1ior pb0ior ? pb7md2 pb7md1 pb7md0 ? pb6md2 pb6md1 pb6md0 pbcrl2 ? pb5md2 pb5md1 pb5md0 ? pb4md2 pb4md1 pb4md0 ? pb3md2 pb3md1 pb3md0 ? pb2md2 pb2md1 pb2md0 pbcrl1 ? pb1md2 pb1md1 pb1md0 ? pb0md2 pb0md1 pb0md0 ? ? ? ? ? ? ? ? i/o pbprl pb7pr pb6pr pb5pr pb4pr pb3 pr pb2pr pb1pr pb0pr ? ? ? ? ? pd10dr pd9dr pd8dr pddrl pd7dr pd6dr pd5dr pd4dr pd3dr pd2dr pd1dr pd0dr ? ? ? ? ? pd10ior pd9ior pd8ior pfc pdiorl pd7ior pd6ior pd5ior pd4ior pd 3ior pd2ior pd1ior pd0ior ? ? ? ? ? pd10md2 pd10md1 pd10md0 pdcrl3 ? pd9md2 pd9md1 pd9md0 ? pd8md2 pd8md1 pd8md0 ? pd7md2 pd7md1 pd7md0 ? pd6md2 pd6md1 pd6md0 pdcrl2 ? pd5md2 pd5md1 pd5md0 ? pd4md2 pd4md1 pd4md0 ? pd3md2 pd3md1 pd3md0 ? pd2md2 pd2md1 pd2md0 pdcrl1 ? pd1md2 pd1md1 pd1md0 ? pd0md2 pd0md1 pd0md0 ? ? ? ? ? pd10pr pd9pr pd8pr i/o pdprl pd7pr pd6pr pd5pr pd4pr pd3pr pd2pr pd1pr pd0pr ? ? ? ? ? ? ? ? pedrh ? ? pe21dr pe20dr pe19dr pe18dr pe17dr pe16dr pe15dr pe14dr pe13dr pe12dr pe11dr pe10dr pe9dr pe8dr pedrl pe7dr pe6dr pe5dr pe4dr pe3dr pe2dr pe1dr pe0dr
section 24 list of registers rev. 3.00 oct. 06, 2008 page 993 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module ? ? ? ? ? ? ? ? pfc peiorh ? ? pe21ior pe20ior pe19ior pe18ior pe17ior pe16ior pe15ior pe14ior pe13ior pe12ior pe11ior pe10ior pe9ior pe8ior peiorl pe7ior pe6ior pe5ior pe4ior pe3ior pe2ior pe1ior pe0ior ? ? ? ? ? ? ? ? pecrh2 ? ? pe21md1 pe21md0 ? ? pe20md1 pe20md0 ? ? pe19md1 pe19md0 ? ? pe18md1 pe18md0 pecrh1 ? ? pe17md1 pe17md0 ? pe16md2 pe16md1 pe16md0 ? pe15md2 pe15md1 pe15md0 ? pe14md2 pe14md1 pe14md0 pecrl4 ? ? pe13md1 pe13md0 ? pe12md2 pe12md1 pe12md0 ? pe11md2 pe11md1 pe11md0 ? pe10md2 pe10md1 pe10md0 pecrl3 ? pe9md2 pe9md1 pe9md0 ? pe8md2 pe8md1 pe8md0 ? pe7md2 pe7md1 pe7md0 ? pe6md2 pe6md1 pe6md0 pecrl2 ? pe5md2 pe5md1 pe5md0 ? pe4md2 pe4md1 pe4md0 ? pe3md2 pe3md1 pe3md0 ? pe2md2 pe2md1 pe2md0 pecrl1 ? pe1md2 pe1md1 pe1md0 ? ? pe0md1 pe0md0 ? ? ? ? ? ? ? ? i/o peprh ? ? pe21pr pe20pr pe19pr pe18pr pe17pr pe16pr pe15pr pe14pr pe13pr pe12pr pe11pr pe10pr pe9pr pe8pr peprl pe7pr pe6pr pe5pr pe4pr pe3 pr pe2pr pe1pr pe0pr adcr_0 adst adcs ace adie ? ? trge extrg adsr_0 ? ? ? ? ? ? ? adf a/d (channel 0) adstrgr_0 ? str6 str5 str4 str3 str2 str1 str0 adansr_0 ans7 ans6 ans5 ans4 ans3 ans2 ans1 ans0 ? ? ? ? add[11:8] addr0 add[7:0] ? ? ? ? add[11:8] addr1 add[7:0] ? ? ? ? add[11:8] addr2 add[7:0]
section 24 list of registers rev. 3.00 oct. 06, 2008 page 994 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module ? ? ? ? add[11:8] addr3 add[7:0] a/d (channel 0) ? ? ? ? add[11:8] addr4 add[7:0] ? ? ? ? add[11:8] addr5 add[7:0] ? ? ? ? add[11:8] addr6 add[7:0] ? ? ? ? add[11:8] addr7 add[7:0] adcr_1 adst adcs ace adie ? ? trge extrg adsr_1 ? ? ? ? ? ? ? adf a/d (channel 1) adstrgr_1 ? str6 str5 str4 str3 str2 str1 str0 adansr_1 ans7 ans6 ans5 ans4 ans3 ans2 ans1 ans0 ? ? ? ? add[11:8] addr8 add[7:0] ? ? ? ? add[11:8] addr9 add[7:0] ? ? ? ? add[11:8] addr10 add[7:0] ? ? ? ? add[11:8] addr11 add[7:0] ? ? ? ? add[11:8] addr12 add[7:0] ? ? ? ? add[11:8] addr13 add[7:0] ? ? ? ? add[11:8] addr14 add[7:0] ? ? ? ? add[11:8] addr15 add[7:0]
section 24 list of registers rev. 3.00 oct. 06, 2008 page 995 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module mcr15 mcr14 ? ? ? tst[2:0] mcr_0 mcr7 mcr6 mcr5 ? ? mcr2 mcr1 mcr0 rcan-et (channel 0) ? ? ? ? ? ? ? ? gsr_0 ? ? gsr5 gsr4 gsr3 gsr2 gsr1 gsr0 tsg1[3:0] ? tsg2[2:0] bcr1_0 ? ? sjw[1:0] ? ? ? bsp ? ? ? ? ? ? ? ? bcr0_0 brp[7:0] ? ? irr13 irr12 ? ? irr9 irr8 irr_0 irr7 irr6 irr5 irr4 i rr3 irr2 irr1 irr0 imr15 imr14 imr13 imr12 im r11 imr10 imr9 imr8 imr_0 imr7 imr6 imr5 imr4 imr3 imr2 imr1 imr0 tec_0/rec_0 tec7 tec6 tec5 tec4 tec3 tec2 tec1 tec0 rec7 rec6 rec5 rec4 rec3 rec2 rec1 rec0 txpr1[15:8] txpr1[7:0] txpr0[15:8] txpr1_0, txpr 0_0 txpr0[7:1] ? txcr0[15:8] txcr0_0 txcr0[7:1] ? txack0[15:8] txack0_0 txack0[7:1] ? aback0[15:8] aback 0_0 aback0[7:1] ? rxpr0[15:8] rxpr0_0 rxpr0[7:0] rfpr0[15:8] rfpr0_0 rfpr0[7:0] mbimr0[15:8] mbimr0_0 mbimr0[7:0]
section 24 list of registers rev. 3.00 oct. 06, 2008 page 996 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module umsr0[15:8] umsr0_0 umsr0[7:0] rcan-et (channel 0) ide rtr ? stdid[10:6] mb[0]. control0h stdid[5:0] extid[17:16] rcan-et (mcr15 = 1) ? stdid[10:4] mb[0]. control0h stdid[3:0] rtr ide extid[17:16] rcan-et (mcr15 = 0) extid[15:8] mb[0]. control0l extid[7:0] rcan-et (channel 0) ide_lafm ? ? stdid_lafm[10:6] mb[0]. lafmh stdid_lafm[5:0] extid_lafm[17:16] rcan-et (mcr15 = 1) (channel 0) ? stdid_lafm[10:4] mb[0]. lafmh stdid_lafm[3:0] ? ide_lafm extid_lafm[17:16] rcan-et (mcr15 = 0) (channel 0) extid_lafm[15:8] mb[0]. lafml extid_lafm[7:0] rcan-et (channel 0) mb[0]. msg_data[0] msg_data_0 mb[0]. msg_data[1] msg_data_1 mb[0]. msg_data[2] msg_data_2 mb[0]. msg_data[3] msg_data_3 mb[0]. msg_data[4] msg_data_4 mb[0]. msg_data[5] msg_data_5 mb[0]. msg_data[6] msg_data_6 mb[0]. msg_data[7] msg_data_7 mb[0]. control1h ? ? nmc ? ? mbc[2:0] mb[0]. control1l ? ? ? ? dlc[3:0]
section 24 list of registers rev. 3.00 oct. 06, 2008 page 997 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module mb[1] same bit configuration as mb[0] rcan-et mb[2] same bit configuration as mb[0] mb[3] same bit configuration as mb[0] (repeat) mb[13] same bit configuration as mb[0] mb[14] same bit configuration as mb[0] mb[15] same bit configuration as mb[0] mcr15 mcr14 ? ? ? tst[2:0] mcr_1 mcr7 mcr6 mcr5 ? ? mcr2 mcr1 mcr0 ? ? ? ? ? ? ? ? gsr_1 ? ? gsr5 gsr4 gsr3 gsr2 gsr1 gsr0 tsg1[3:0] ? tsg2[2:0] bcr1_1 ? ? sjw[1:0] ? ? ? bsp ? ? ? ? ? ? ? ? bcr0_1 brp[7:0] ? ? irr13 irr12 ? ? irr9 irr8 irr_1 irr7 irr6 irr5 irr4 irr3 irr2 irr1 irr0 imr15 imr14 imr13 imr12 imr11 imr10 imr9 imr8 imr_1 imr7 imr6 imr5 imr4 imr3 im r2 imr1 imr0 tec7 tec6 tec5 tec4 tec3 tec2 tec1 tec0 tec_1/rec_1 rec7 rec6 rec5 rec4 rec3 rec2 rec1 rec0 txpr1[15:8] txpr1[7:0] txpr0[15:8] txpr1_1, txpr0_1 txpr0[7:1] ? txcr0[15:8] txcr0_1 txcr0[7:1] ? txack0[15:8] txack0_1 txack0[7:1] ? aback0[15:8] aback 0_1 aback0[7:1] ? rcan-et (channel 1) * 1
section 24 list of registers rev. 3.00 oct. 06, 2008 page 998 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module rxpr0[15:8] rxpr0_1 rxpr0[7:0] rfpr0[15:8] rfpr0_1 rfpr0[7:0] mbimr0[15:8] mbimr0_1 mbimr0[7:0] umsr0[15:8] umsr0_1 umsr0[7:0] rcan-et (channel 1) * 1 ide rtr ? stdid[10:6] mb[0]. control0h stdid[5:0] extid[17:16] rcan-et (mcr15 = 1) ? stdid[10:4] mb[0]. control0h stdid[3:0] rtr ide extid[17:16] rcan-et (mcr15 = 0) extid[15:8] mb[0]. control0l extid[7:0] rcan-et (channel 1) * 1 ide_lafm ? ? stdid_lafm[10:6] mb[0]. lafmh stdid_lafm[5:0] extid_lafm[17:16] rcan-et (mcr15 = 1) (channel 1) * 1 ? stdid_lafm[10:4] mb[0]. lafmh stdid_lafm[3:0] ? ide_lafm extid_lafm[17:16] rcan-et (mcr15 = 0) (channel 1) * 1 extid_lafm[15:8] mb[0]. lafml extid_lafm[7:0] mb[0]. msg_data[0] msg_data_0 mb[0]. msg_data[1] msg_data_1 mb[0]. msg_data[2] msg_data_2 mb[0]. msg_data[3] msg_data_3 mb[0]. msg_data[4] msg_data_4 mb[0]. msg_data[5] msg_data_5 rcan-et (channel 1) * 1
section 24 list of registers rev. 3.00 oct. 06, 2008 page 999 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module mb[0]. msg_data[6] msg_data_6 mb[0]. msg_data[7] msg_data_7 mb[0]. control1h ? ? nmc ? ? mbc[2:0] mb[0]. control1l ? ? ? ? dlc[3:0] mb[1] same bit configuration as mb[0] mb[2] same bit configuration as mb[0] mb[3] same bit configuration as mb[0] (repeat) mb[13] same bit configuration as mb[0] mb[14] same bit configuration as mb[0] mb[15] same bit configuration as mb[0] rcan-et (channel 1) * 1 ? ifc[2:0] bfc[2:0] pfc[2] cpg frqcr pfc[1:0] mifc[2:0] mpfc[2:0] stbcr1 stby ? ? ? ? ? ? ? stbcr2 mstp7 mstp6 ? mstp4 ? ? ? ? power-down modes stbcr3 ? ? mstp13 mstp12 mstp11 mstp10 mstp9 * 1 mstp8 stbcr4 mstp23 mstp22 mstp21 mstp20 mstp19 ? ? ? stbcr5 ? ? ? ? ? ? mstp25 mstp24 stbcr6 audsrst hiz ? ? ? ? stbymd ? wtcnt wdt wtcsr tme wt/it rsts wovf iovf cks[2:0] osccr ? ? ? ? ? oscstop ? oscers cpg ramcr ? ? ? rame ? ? ? ? power-down modes dtlock ? ? ? ? ? ? ? bscehr ? ? ? ? ? ? ? ? bsc nmil ? ? ? ? ? ? nmie intc icr0 ? ? ? ? ? ? ? ?
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1000 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module ? ? ? ? ? ? ? ? intc irqcr irq31s irq30s irq21s irq20s ir q11s irq10s irq01s irq00s ? ? ? ? irq3l irq2l irq1l irq0l irqsr ? ? ? ? irq3f irq2f irq1f irq0f irq0 irq0 irq0 irq0 ir q1 irq1 irq1 irq1 ipra irq2 irq2 irq2 irq2 ir q3 irq3 irq3 irq3 mtu2_0 mtu2_0 mtu2_0 mtu2_0 mt u2_0 mtu2_0 mtu2_0 mtu2_0 iprd mtu2_1 mtu2_1 mtu2_1 mtu2_1 mt u2_1 mtu2_1 mtu2_1 mtu2_1 mtu2_2 mtu2_2 mtu2_2 mtu2_2 mt u2_2 mtu2_2 mtu2_2 mtu2_2 ipre mtu2_3 mtu2_3 mtu2_3 mtu2_3 mt u2_3 mtu2_3 mtu2_3 mtu2_3 mtu2_4 mtu2_4 mtu2_4 mtu2_4 mt u2_4 mtu2_4 mtu2_4 mtu2_4 iprf ? ? ? ? poe(mtu2) poe(mtu2) poe(mtu2) poe(mtu2) ? ? ? ? ? ? ? ? iprh mtu2s_3 mtu2s_3 mtu2s_3 mtu2s_3 mt u2s_3 mtu2s_3 mtu2s_3 mtu2s_3 mtu2s_4 mtu2s_4 mtu2s_4 mtu2s_4 mt u2s_4 mtu2s_4 mtu2s_4 mtu2s_4 ipri mtu2s_5 mtu2s_5 mtu2s_5 mtu2s_5 poe(mtu2s) poe(mtu2s) poe(mtu2s) poe(mtu2s) cmt_0 cmt_0 cmt_0 cmt_0 cm t_1 cmt_1 cmt_1 cmt_1 iprj ? ? ? ? wdt wdt wdt wdt ? ? ? ? ? ? ? ? iprk a/d_0 a/d_0 a/d_0 a/d_0 a/d_1 a/d_1 a/d_1 a/d_1 sci_0 sci_0 sci_0 sci_0 sci_1 sci_1 sci_1 sci_1 iprl sci_2 sci_2 sci_2 sci_2 ? ? ? ? * 2 * 2 * 2 * 2 ? ? ? ? iprm rcan-et_0 rcan-et_0 rcan-et_0 rcan-et_0 rcan-et_1 * 1 rcan-et_1 * 1 rcan-et_1 * 1 rcan-et_1 * 1 ? ? ? ? ? ? ? ? bsc ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cmncr ? ? ? ? ? ? hizmem ? ? ? iww[1:0] ? iwrwd[1:0] ? iwrws[1:0] ? iwrrd[1:0] ? iwrrs[1:0] ? ? ? ? ? bsz[1:0] ? cs0bcr ? ? ? ? ? ? ? ?
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1001 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module ? ? iww[1:0] ? iwrwd[1:0] ? bsc iwrws[1:0] ? iwrrd[1:0] ? iwrrs[1:0] ? ? ? ? ? bsz[1:0] ? cs1bcr ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ww[2:0] ? ? ? sw[1:0] wr[3:1] cs0wcr wr[0] wm ? ? ? ? hw[1:0] ? ? ? ? ? ? ? ? ? ? ? ? ? ww[2:0] ? ? ? sw[1:0] wr[3:1] cs1wcr wr[0] wm ? ? ? ? hw[1:0] ? ? ? ? ? ? ? ? flash ramer ? ? ? ? rams ram[2:0] baa31 baa30 baa29 baa28 baa27 baa26 baa25 baa24 ubc baa23 baa22 baa21 baa20 baa19 baa18 baa17 baa16 baa15 baa14 baa13 baa12 baa11 baa10 baa9 baa8 bara baa7 baa6 baa5 baa4 baa3 baa2 baa1 baa0 bama31 bama30 bama29 bama28 bama27 bama26 bama25 bama24 bama23 bama22 bama21 bama20 bama19 bama18 bama17 bama16 bama15 bama14 bama13 bama12 bama11 bama10 bama9 bama8 bamra bama7 bama6 bama5 bama4 bama3 bama2 bama1 bama0 ? ? ? ? ? cpa[2:0] bbra cda[1:0] ida[1:0] rwa[1:0] sza[1:0] bda31 bda30 bda29 bda28 bd a27 bda26 bda25 bda24 bda23 bda22 bda21 bda20 bd a19 bda18 bda17 bda16 bda15 bda14 bda13 bda12 bd a11 bda10 bda9 bda8 bdra bda7 bda6 bda5 bda4 bd a3 bda2 bda1 bda0 bdma31 bdma30 bdma29 bdma28 bdma27 bdma26 bdma25 bdma24 bdma23 bdma22 bdma21 bdma20 bdma19 bdma18 bdma17 bdma16 bdma15 bdma14 bdma13 bdma12 bdma11 bdma10 bdma9 bdma8 bdmra bdma7 bdma6 bdma5 bdma4 bdma3 bdma2 bdma1 bdma0
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1002 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module bab31 bab30 bab29 bab28 bab27 bab26 bab25 bab24 ubc bab23 bab22 bab21 bab20 bab19 bab18 bab17 bab16 bab15 bab14 bab13 bab12 bab11 bab10 bab9 bab8 barb bab7 bab6 bab5 bab4 bab3 bab2 bab1 bab0 bamb31 bamb30 bamb29 bamb28 bamb27 bamb26 bamb25 bamb24 bamb23 bamb22 bamb21 bamb20 bamb19 bamb18 bamb17 bamb16 bamb15 bamb14 bamb13 bamb12 bamb11 bamb10 bamb9 bamb8 bamrb bamb7 bamb6 bamb5 bamb4 bamb3 bamb2 bamb1 bamb0 ? ? ? ? ? cpb[2:0] bbrb cdb[1:0] idb[1:0] rwb[1:0] szb[1:0] bdb31 bdb30 bdb29 bdb28 bd b27 bdb26 bdb25 bdb24 bdb23 bdb22 bdb21 bdb20 bd b19 bdb18 bdb17 bdb16 bdb15 bdb14 bdb13 bdb12 bd b11 bdb10 bdb9 bdb8 bdrb bdb7 bdb6 bdb5 bdb4 bd b3 bdb2 bdb1 bdb0 bdmb31 bdmb30 bdmb29 bdmb28 bdmb27 bdmb26 bdmb25 bdmb24 bdmb23 bdmb22 bdmb21 bdmb20 bdmb19 bdmb18 bdmb17 bdmb16 bdmb15 bdmb14 bdmb13 bdmb12 bdmb11 bdmb10 bdmb9 bdmb8 bdmrb bdmb7 bdmb6 bdmb5 bdmb4 bdmb3 bdmb2 bdmb1 bdmb0 ? ? ? ? ? ? ? ? ? ? utrgw[1:0] ubidb ? ubida ? scmfca scmfcb scmfda scmfdb pcte pcba ? ? brcr dbea pcbb dbeb ? seq ? ? etbe svf ? ? ? bsa27 bsa26 bsa25 bsa24 bsa23 bsa22 bsa21 bsa20 bsa19 bsa18 bsa17 bsa16 bsa15 bsa14 bsa13 bsa12 bsa11 bsa10 bsa9 bsa8 brsr bsa7 bsa6 bsa5 bsa4 bsa3 bsa2 bsa1 bsa0 dvf ? ? ? bda27 bda26 bda25 bda24 bda23 bda22 bda21 bda20 bd a19 bda18 bda17 bda16 bda15 bda14 bda13 bda12 bd a11 bda10 bda9 bda8 brdr bda7 bda6 bda5 bda4 bd a3 bda2 bda1 bda0
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1003 of 1080 rej09b0230-0300 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module ? ? ? ? bet[11:8] ubc betr bet[7:0] ? ? ? ? ? ? ? ? aud ? ? ? ? ? ? ? ? clk[1:0] ? ? bre oc[1:0] br aucsr wa[1:0] wb[1:0] ? ? tm en auwasr auwaer auwbsr auwber ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? waob ? auecsr ? wbob ? ? trex trsb trgn ? notes: 1. available only in the sh7142. 2. synchronous serial communication unit
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1004 of 1080 rej09b0230-0300 24.3 register states in each operating mode register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module scsmr_0 initialized retained initialized initialized initialized retained initialized scbrr_0 initialized retained initialized initialized initialized retained initialized scscr_0 initialized retained initialized initialized initialized retained initialized sctdr_0 initialized retained initialized initialized initialized retained initialized scssr_0 initialized retained initialized initialized initialized retained initialized scrdr_0 initialized retained initialized in itialized initialized retained initialized scsdcr_0 initialized retained initialized initialized initialized retained initialized scsptr_0 initialized retained initialized initialized initialized retained initialized sci (channel 0) scsmr_1 initialized retained initialized initialized initialized retained initialized scbrr_1 initialized retained initialized initialized initialized retained initialized scscr_1 initialized retained initialized initialized initialized retained initialized sctdr_1 initialized retained initialized initialized initialized retained initialized scssr_1 initialized retained initialized initialized initialized retained initialized scrdr_1 initialized retained initialized in itialized initialized retained initialized scsdcr_1 initialized retained initialized initialized initialized retained initialized scsptr_1 initialized retained initialized initialized initialized retained initialized sci (channel 1) scsmr_2 initialized retained initialized initialized initialized retained initialized scbrr_2 initialized retained initialized initialized initialized retained initialized scscr_2 initialized retained initialized initialized initialized retained initialized sctdr_2 initialized retained initialized initialized initialized retained initialized scssr_2 initialized retained initialized initialized initialized retained initialized scrdr_2 initialized retained initialized in itialized initialized retained initialized scsdcr_2 initialized retained initialized initialized initialized retained initialized scsptr_2 initialized retained initialized initialized initialized retained initialized sci (channel 2) tcr_3 initialized retained initialized initialized initialized retained initialized mtu2 tcr_4 initialized retained initialized initialized initialized retained initialized tmdr_3 initialized retained initialized initialized initialized retained initialized tmdr_4 initialized retained initialized initialized initialized retained initialized tiorh_3 initialized retained initialized initialized initialized retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1005 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module tiorl_3 initialized retained initialized initialized initialized retained initialized mtu2 tiorh_4 initialized retained initialized initialized initialized retained initialized tiorl_4 initialized retained initialized initialized initialized retained initialized tier_3 initialized retained initialized initialized initialized retained initialized tier_4 initialized retained initialized initialized initialized retained initialized toer initialized retained initialized initialized initialized retained initialized tgcr initialized retained initialized initialized initialized retained initialized tocr1 initialized retained initialized initialized initialized retained initialized tocr2 initialized retained initialized initialized initialized retained initialized tcnt_3 initialized retained initialized initialized initialized retained initialized tcnt_4 initialized retained initialized initialized initialized retained initialized tcdr initialized retained in itialized initialized initia lized retained initialized tddr initialized retained in itialized initialized initia lized retained initialized tgra_3 initialized retained initialized initialized initialized retained initialized tgrb_3 initialized retained initialized initialized initialized retained initialized tgra_4 initialized retained initialized initialized initialized retained initialized tgrb_4 initialized retained initialized initialized initialized retained initialized tcnts initialized retained initialized initialized initialized retained initialized tcbr initialized retained initialized initialized initialized retained initialized tgrc_3 initialized retained initialized initialized initialized retained initialized tgrd_3 initialized retained initialized initialized initialized retained initialized tgrc_4 initialized retained initialized initialized initialized retained initialized tgrd_4 initialized retained initialized initialized initialized retained initialized tsr_3 initialized retained initialized initialized initialized retained initialized tsr_4 initialized retained initialized initialized initialized retained initialized titcr initialized retained initialized initialized initialized retained initialized titcnt initialized retained initialized initialized initialized retained initialized tbter initialized retained initialized initialized initialized retained initialized tder initialized retained initialized initialized initialized retained initialized tolbr initialized retained initialized initialized initialized retained initialized tbtm_3 initialized retained initialized initialized initialized retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1006 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module tbtm_4 initialized retained initialized initialized initialized retained initialized mtu2 tadcr initialized retained in itialized initialized initia lized retained initialized tadcora_4 initialized retained initialized initialized initialized retained initialized tadcorb_4 initialized retained initialized initialized initialized retained initialized tadcobra_4 initialized retained initialized initialized initialized retained initialized tadcobrb_4 initialized retained initialized initialized initialized retained initialized twcr initialized retained initialized initialized initialized retained initialized tstr initialized retained initialized initialized initialized retained initialized tsyr initialized retained initialized initialized initialized retained initialized tcsystr initialized retai ned initialized initialized initialized retained initialized trwer initialized retained initialized initialized initialized retained initialized tcr_0 initialized retained initialized initialized initialized retained initialized tmdr_0 initialized retained initialized initialized initialized retained initialized tiorh_0 initialized retained initialized initialized initialized retained initialized tiorl_0 initialized retained initialized initialized initialized retained initialized tier_0 initialized retained initialized initialized initialized retained initialized tsr_0 initialized retained initialized initialized initialized retained initialized tcnt_0 initialized retained initialized initialized initialized retained initialized tgra_0 initialized retained initialized initialized initialized retained initialized tgrb_0 initialized retained initialized initialized initialized retained initialized tgrc_0 initialized retained initialized initialized initialized retained initialized tgrd_0 initialized retained initialized initialized initialized retained initialized tgre_0 initialized retained initialized initialized initialized retained initialized tgrf_0 initialized retained initialized initialized initialized retained initialized tier2_0 initialized retained initialized initialized initialized retained initialized tsr2_0 initialized retained initialized initialized initialized retained initialized tbtm_0 initialized retained initialized initialized initialized retained initialized tcr_1 initialized retained initialized initialized initialized retained initialized tmdr_1 initialized retained initialized initialized initialized retained initialized tior_1 initialized retained initialized initialized initialized retained initialized tier_1 initialized retained initialized initialized initialized retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1007 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module tsr_1 initialized retained initialized initialized initialized retained initialized mtu2 tcnt_1 initialized retained initialized initialized initialized retained initialized tgra_1 initialized retained initialized initialized initialized retained initialized tgrb_1 initialized retained initialized initialized initialized retained initialized ticcr initialized retained in itialized initialized initia lized retained initialized tcr_2 initialized retained initialized initialized initialized retained initialized tmdr_2 initialized retained initialized initialized initialized retained initialized tior_2 initialized retained initialized initialized initialized retained initialized tier_2 initialized retained initialized initialized initialized retained initialized tsr_2 initialized retained initialized initialized initialized retained initialized tcnt_2 initialized retained initialized initialized initialized retained initialized tgra_2 initialized retained initialized initialized initialized retained initialized tgrb_2 initialized retained initialized initialized initialized retained initialized tcr_3s initialized retained initialized initialized initialized retained initialized mtu2s tcr_4s initialized retained initialized initialized initialized retained initialized tmdr_3s initialized retained initialized initialized initialized retained initialized tmdr_4s initialized retained initialized initialized initialized retained initialized tiorh_3s initialized retained initialized initialized initialized retained initialized tiorl_3s initialized retained initialized initialized initialized retained initialized tiorh_4s initialized retained initialized initialized initialized retained initialized tiorl_4s initialized retained initialized initialized initialized retained initialized tier_3s initialized retained initialized initialized initialized retained initialized tier_4s initialized retained initialized initialized initialized retained initialized toers initialized retained initialized initialized initialized retained initialized tgcrs initialized retained initialized initialized initialized retained initialized tocr1s initialized retained initialized initialized initialized retained initialized tocr2s initialized retained initialized initialized initialized retained initialized tcnt_3s initialized retained initialized initialized initialized retained initialized tcnt_4s initialized retained initialized initialized initialized retained initialized tcdrs initialized retained in itialized initialized initia lized retained initialized tddrs initialized retained in itialized initialized initia lized retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1008 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module tgra_3s initialized retained initialized initialized initialized retained initialized mtu2s tgrb_3s initialized retained initialized initialized initialized retained initialized tgra_4s initialized retained initialized initialized initialized retained initialized tgrb_4s initialized retained initialized initialized initialized retained initialized tcntss initialized retained initialized initialized initialized retained initialized tcbrs initialized retained initialized initialized initialized retained initialized tgrc_3s initialized retained initialized initialized initialized retained initialized tgrd_3s initialized retained initialized initialized initialized retained initialized tgrc_4s initialized retained initialized initialized initialized retained initialized tgrd_4s initialized retained initialized initialized initialized retained initialized tsr_3s initialized retained initialized initialized initialized retained initialized tsr_4s initialized retained initialized initialized initialized retained initialized titcrs initialized retained initialized initialized initialized retained initialized titcnts initialized retained initialized initialized initialized retained initialized tbters initialized retained initialized initialized initialized retained initialized tders initialized retained initialized initialized initialized retained initialized tolbrs initialized retained initialized initialized initialized retained initialized tbtm_3s initialized retained initialized initialized initialized retained initialized tbtm_4s initialized retained initialized initialized initialized retained initialized tadcrs initialized retained in itialized initialized initia lized retained initialized tadcora_4s initialized retained initialized initialized initialized retained initialized tadcorb_4s initialized retained initialized initialized initialized retained initialized tadcobra_4s initialized retained initialized initialized initialized retained initialized tadcobrb_4s initialized retained initialized initialized initialized retained initialized tsycrs initialized retained initialized initialized initialized retained initialized twcrs initialized retained initialized initialized initialized retained initialized tstrs initialized retained initialized initialized initialized retained initialized tsyrs initialized retained initialized initialized initialized retained initialized trwers initialized retained initialized initialized initialized retained initialized tcntu_5s initialized retained initialized initialized initialized retained initialized tgru_5s initialized retained initialized initialized initialized retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1009 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module tcru_5s initialized retained initialized initialized initialized retained initialized mtu2s tioru_5s initialized retained initialized initialized initialized retained initialized tcntv_5s initialized retained initialized initialized initialized retained initialized tgrv_5s initialized retained initialized initialized initialized retained initialized tcrv_5s initialized retained initialized initialized initialized retained initialized tiorv_5s initialized retained initialized initialized initialized retained initialized tcntw_5s initialized retained initialized initialized initialized retained initialized tgrw_5s initialized retained initialized initialized initialized retained initialized tcrw_5s initialized retained initialized initialized initialized retained initialized tiorw_5s initialized retained initialized initialized initialized retained initialized tsr_5s initialized retained initialized initialized initialized retained initialized tier_5s initialized retained initialized initialized initialized retained initialized tstr_5s initialized retained initialized initialized initialized retained initialized tcntcmpclrs initialized retained initialized initialized initialized retained initialized fccs initialized retained initialized initialized initialized retained initialized flash fpcs initialized retained initialized initialized initialized retained initialized fecs initialized retained initialized initialized initialized retained initialized fkey initialized retai ned initialized initialized initialized retained initialized fmats initialized retained initialized initialized initialized retained initialized ftdar initialized retained initialized initialized initialized retained initialized dtcera initialized retained retained initialized retained retained initialized dtc dtcerb initialized retained retained initialized retained retained initialized dtcerc initialized retained retained initialized retained retained initialized dtcerd initialized retained retained initialized retained retained initialized dtcere initialized retained retained initialized retained retained initialized dtccr initialized retained retained init ialized retained retained initialized dtcvbr initialized retained retained initialized retained retained initialized sscrh initialized retained in itialized initialized initia lized retained initialized sscrl initialized retained initialized initialized initialized retained initialized ssmr initialized retained initialized initialized initialized retained initialized synchronous serial communication unit sser initialized retai ned initialized initialized initialized retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1010 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module sssr initialized retai ned initialized initialized initialized retained initialized sscr2 initialized retained initialized initialized initialized retained initialized sstdr0 initialized retained initialized initialized initialized retained initialized sstdr1 initialized retained initialized initialized initialized retained initialized synchronous serial communication unit sstdr2 initialized retained initialized initialized initialized retained initialized sstdr3 initialized retained initialized initialized initialized retained initialized ssrdr0 initialized retained in itialized initialized initia lized retained initialized ssrdr1 initialized retained in itialized initialized initia lized retained initialized ssrdr2 initialized retained in itialized initialized initia lized retained initialized ssrdr3 initialized retained in itialized initialized initia lized retained initialized cmstr initialized retained initialized initialized initialized retained initialized cmt cmcsr_0 initialized retained initialized initialized initialized retained initialized cmcnt_0 initialized retained initialized initialized initialized retained initialized cmcor_0 initialized retained initialized initialized initialized retained initialized cmcsr_1 initialized retained initialized initialized initialized retained initialized cmcnt_1 initialized retained initialized initialized initialized retained initialized cmcor_1 initialized retained initialized initialized initialized retained initialized icsr1 initialized retained retained initialized ? retained initialized poe ocsr1 initialized retained retained initialized ? retained initialized icsr2 initialized retained retained initialized ? retained initialized ocsr2 initialized retained retained initialized ? retained initialized icsr3 initialized retained retained initialized ? retained initialized spoer initialized retained retained initialized ? retained initialized poecr1 initialized retained retained initialized ? retained initialized poecr2 initialized retained retained initialized ? retained initialized padrl initialized retained retained initialized ? retained initialized i/o paiorl initialized retained retained initialized ? retained initialized pfc pacrl4 initialized retained retained initialized ? retained initialized pacrl3 initialized retained retained initialized ? retained initialized pacrl2 initialized retained retained initialized ? retained initialized pacrl1 initialized retained retained initialized ? retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1011 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module paprl initialized retai ned retained initialized ? retained initialized i/o pbdrl initialized retained retained initialized ? retained initialized pbiorl initialized retained retained initialized ? retained initialized pfc pbcrl2 initialized retained retained initialized ? retained initialized pbcrl1 initialized retained retained initialized ? retained initialized pbprl initialized retai ned retained initialized ? retained initialized i/o pddrl initialized retai ned retained initialized ? retained initialized pdiorl initialized retained retained initialized ? retained initialized pfc pdcrl3 initialized retained retained initialized ? retained initialized pdcrl2 initialized retained retained initialized ? retained initialized pdcrl1 initialized retained retained initialized ? retained initialized pdprl initialized retained retained initialized ? retained initialized i/o pedrh initialized retai ned retained initialized ? retained initialized pedrl initialized retained retained initialized ? retained initialized peiorh initialized retained retained initialized ? retained initialized pfc peiorl initialized retained retained initialized ? retained initialized pecrh2 initialized retai ned retained initialized ? retained initialized pecrh1 initialized retai ned retained initialized ? retained initialized pecrl4 initialized retained retained initialized ? retained initialized pecrl3 initialized retained retained initialized ? retained initialized pecrl2 initialized retained retained initialized ? retained initialized pecrl1 initialized retained retained initialized ? retained initialized peprh initialized retained retained initialized ? retained initialized i/o peprl initialized retai ned retained initialized ? retained initialized adcr_0 initialized retained initialized initialized initialized retained initialized a/d adsr_0 initialized retained initialized initialized initialized retained initialized (channel 0) adstrgr_0 initialized retained initialized initialized initialized retained initialized adansr_0 initialized retained initialized initialized initialized retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1012 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module addr0 initialized retained initia lized initialized initialized reta ined initialized a/d (channel 0) addr1 initialized retained in itialized initialized initia lized retained initialized addr2 initialized retained in itialized initialized initia lized retained initialized addr3 initialized retained in itialized initialized initia lized retained initialized addr4 initialized retained in itialized initialized initia lized retained initialized addr5 initialized retained in itialized initialized initia lized retained initialized addr6 initialized retained in itialized initialized initia lized retained initialized addr7 initialized retained in itialized initialized initia lized retained initialized adcr_1 initialized retained initialized initialized initialized retained initialized a/d (channel 1) adsr_1 initialized retained initialized initialized initialized retained initialized adstrgr_1 initialized retained initialized initialized initialized retained initialized adansr_1 initialized retained initialized initialized initialized retained initialized addr8 initialized retained in itialized initialized initia lized retained initialized addr9 initialized retained in itialized initialized initia lized retained initialized addr10 initialized retained initialized initialized initialized retained initialized addr11 initialized retained initialized initialized initialized retained initialized addr12 initialized retained initialized initialized initialized retained initialized addr13 initialized retained initialized initialized initialized retained initialized addr14 initialized retained initialized initialized initialized retained initialized addr15 initialized retained initialized initialized initialized retained initialized mcr_0 initialized retained initialized initialized initialized retained initialized gsr_0 initialized retained initialized initialized initialized retained initialized rcan-et (channel 0) bcr1_0 initialized retained initialized initialized initialized retained initialized bcr0_0 initialized retained initialized initialized initialized retained initialized irr_0 initialized retained initialized initialized initialized retained initialized imr_0 initialized retained initialized initialized initialized retained initialized tec_0/rec_0 initialized retained initialized initialized initialized retained initialized txpr1_0, txpr0_0 initialized retained initialized initialized initialized retained initialized txcr0_0 initialized retained initialized initialized initialized retained initialized txack0_0 initialized retained initialized initialized initialized retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1013 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module aback 0_0 initialized retained initialized initialized initialized retained initialized rxpr0_0 initialized retained initialized initialized initialized retained initialized rfpr0_0 initialized retained initialized initialized initialized retained initialized rcan-et (channel 0) mbimr0_0 initialized retained initialized initialized initialized retained initialized umsr0_0 initialized retained initialized initialized initialized retained initialized mb[0]. control0h ? retained ? ? ? retained ? mb[0]. control0l ? retained ? ? ? retained ? mb[0]. lafmh ? retained ? ? ? retained ? mb[0]. lafml ? retained ? ? ? retained ? mb[0]. msg_data[0] ? retained ? ? ? retained ? mb[0]. msg_data[1] ? retained ? ? ? retained ? mb[0]. msg_data[2] ? retained ? ? ? retained ? mb[0]. msg_data[3] ? retained ? ? ? retained ? mb[0]. msg_data[4] ? retained ? ? ? retained ? mb[0]. msg_data[5] ? retained ? ? ? retained ? mb[0]. msg_data[6] ? retained ? ? ? retained ? mb[0]. msg_data[7] ? retained ? ? ? retained ? mb[0]. control1h initialized retained initialized initialized initialized retained initialized mb[0]. control1l initialized retained initialized initialized initialized retained initialized mb[1] same as mb[0]
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1014 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module mb[2] same as mb[0] mb[3] same as mb[0] rcan-et (channel 0) (repeat) mb[13] same as mb[0] mb[14] same as mb[0] mb[15] same as mb[0] mcr_1 initialized retained initialized initialized initialized retained initialized gsr_1 initialized retained initialized initialized initialized retained initialized bcr1_1 initialized retained initialized initialized initialized retained initialized bcr0_1 initialized retained initialized initialized initialized retained initialized irr_1 initialized retained initialized initialized initialized retained initialized imr_1 initialized retained initialized initialized initialized retained initialized tec_1/rec_1 initialized retained initialized initialized initialized retained initialized txpr1_1, txpr0_1 initialized retained initialized initialized initialized retained initialized txcr0_1 initialized retained initialized initialized initialized retained initialized txack0_1 initialized retained initialized initialized initialized retained initialized aback 0_1 initialized retained initialized initialized initialized retained initialized rxpr0_1 initialized retained initialized initialized initialized retained initialized rfpr0_1 initialized retained initialized initialized initialized retained initialized mbimr0_1 initialized retained initialized initialized initialized retained initialized umsr0_1 initialized retained initialized initialized initialized retained initialized mb[0]. control0h ? retained ? ? ? retained ? mb[0]. control0l ? retained ? ? ? retained ? mb[0]. lafmh ? retained ? ? ? retained ? mb[0]. lafml ? retained ? ? ? retained ? mb[0]. msg_data[0] ? retained ? ? ? retained ? rcan-et (channel 1) * 1 mb[0]. msg_data[1] ? retained ? ? ? retained ?
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1015 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module mb[0]. msg_data[2] ? retained ? ? ? retained ? mb[0]. msg_data[3] ? retained ? ? ? retained ? mb[0]. msg_data[4] ? retained ? ? ? retained ? mb[0]. msg_data[5] ? retained ? ? ? retained ? mb[0]. msg_data[6] ? retained ? ? ? retained ? mb[0]. msg_data[7] ? retained ? ? ? retained ? mb[0]. control1h initialized retained initialized initialized initialized retained initialized mb[0]. control1l initialized retained initialized initialized initialized retained initialized mb[1] same as mb[0] mb[2] same as mb[0] mb[3] same as mb[0] (repeat) mb[13] same as mb[0] mb[14] same as mb[0] mb[15] same as mb[0] rcan-et (channel 1) * 1 frqcr initialized * 2 retained retained initialized ? retained initialized cpg stbcr1 initialized retained retained initialized ? retained initialized stbcr2 initialized retained retained initialized ? retained initialized power-down modes stbcr3 initialized retained retained initialized ? retained initialized stbcr4 initialized retained retained initialized ? retained initialized stbcr5 initialized retained retained initialized ? retained initialized stbcr6 initialized retained retained initialized ? retained initialized wtcnt initialized * 2 retained retained initialized ? retained initialized wdt wtcsr initialized * 2 retained retained initialized ? retained initialized osccr initialized * 3 retained retained * 4 initialized ? retained initialized cpg
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1016 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module ramcr initialized retained retained initialized ? retained initialized power-down modes bscehr initialized retained retained initialized ? retained initialized bsc icr0 initialized initialized retained initialized ? retained initialized intc irqcr initialized initialized retained initialized ? retained initialized irqsr initialized initialized retained initialized ? retained initialized ipra initialized initialized retained initialized ? retained initialized iprd initialized initialized retained initialized ? retained initialized ipre initialized initialized retained initialized ? retained initialized iprf initialized initialized retained initialized ? retained initialized iprh initialized initialized retained initialized ? retained initialized ipri initialized initialized retained initialized ? retained initialized iprj initialized initialized retained initialized ? retained initialized iprk initialized initialized retained initialized ? retained initialized iprl initialized initialized retained initialized ? retained initialized iprm initialized initialized retained initialized ? retained initialized cmncr initialized retai ned retained initialized ? retained initialized bsc cs0bcr initialized retained retained initialized ? retained initialized cs1bcr initialized retained retained initialized ? retained initialized cs0wcr initialized retained retained initialized ? retained initialized cs1wcr initialized retained retained initialized ? retained initialized ramer initialized initialized retained initialized retained retained initialized flash bara initialized retained retained initialized initialized retained initialized ubc bamra initialized retained retained initialized initialized retained initialized bbra initialized retained retained initialized initialized retained initialized bdra initialized retained retained initialized initialized retained initialized bdmra initialized retained retained initialized initialized retained initialized barb initialized retained retained initialized initialized retained initialized bamrb initialized retained retained initialized initialized retained initialized bbrb initialized retained retained initialized initialized retained initialized bdrb initialized retained retained initialized initialized retained initialized
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1017 of 1080 rej09b0230-0300 register abbreviation power-on reset manual reset software standby deep software standby module standby sleep hardware standby module bdmrb initialized retained retained initialized initialized retained initialized ubc brcr initialized retained retained initia lized initialized retained initialized brsr initialized initialized retained initialized initialized retained initialized brdr initialized initialized retained initialized initia lized retained initialized betr initialized retained retained initialized initialized retained initialized aucsr initialized initialized retained initialized retained retained initialized aud auwasr initialized initialized retained initialized retained retained initialized auwaer initialized initialized retained initialized retained retained initialized auwbsr initialized initialized retained initialized retained retained initialized auwber initialized initialized retained initialized retained retained initialized auecsr initialized initialized retained initialized retained retained initialized notes: 1. available only in the sh7142. 2. not initialized by a wdt power-on reset. 3. the oscstop bit is not initialized by a wdt power-on reset. 4. the oscstop bit is initialized.
section 24 list of registers rev. 3.00 oct. 06, 2008 page 1018 of 1080 rej09b0230-0300
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1019 of 1080 rej09b0230-0300 section 25 electrical characteristics the specifications shown in this section are pr eliminary. after the ch aracteristics have been evaluated, the specifications may be changed without notice. 25.1 absolute maximum ratings table 25.1 lists the absolute maximum ratings. table 25.1 absolute maximum ratings item symbol value unit regular specifications ? 0.3 to + 7.0 v power supply voltage (internal) wide-range specifications v cc ? 0.3 to + 4.3 v power supply voltage (i/o) pv cc ? 0.3 to + 7.0 v input voltage (except analog input pins) v in ? 0.3 to pv cc + 0.3 v analog power supply voltage av cc ? 0.3 to + 7.0 v analog reference voltage av refh ? 0.3 to av cc + 0.3 v analog input voltage v an ? 0.3 to av cc + 0.3 v regular specifications t opr ? 40 to + 85 c operating temperature (except flash memory write/erase) wide-range specifications ? 40 to + 125 c operating temperature (flash memory write/erase) twe opr ? 40 to + 85 c storage temperature t stg ? 55 to + 125 c [operating precautions] operating the lsi in excess of the absolute maximum ratings may result in permanent damage.
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1020 of 1080 rej09b0230-0300 25.2 dc characteristics tables 25.2 and 25.3 list dc characteristics. table 25.2 dc characteristics (regular specifications) conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c item symbol min. typ. max. unit test conditions res , hstby , nmi, fwe, md1, md0, extal v ih pv cc ? 0.6 ? pv cc +0.3 v analog pins 2.2 ? av cc +0.3 v input high-level voltage (except schmitt trigger input voltage) other input pins 2.2 ? pv cc +0.3 v res , hstby , nmi, fwe, md1, md0, extal ? 0.3 ? 0.4 v input low-level voltage (except schmitt trigger input voltage) other input pins v il ? 0.3 ? 0.8 v v t+ pv cc ? 0.5 ? ? v v t? ? ? 1.0 v schmitt trigger input voltage irq3 to irq0, poe0 to poe2 , poe4 to poe6 , poe8 , tclka to tclkd, tioc0a to tioc0d, tioc1a, tioc1b, tioc2a, tioc2b, tioc3a to tioc3d, tioc4a to tioc4d, tioc3bs, tioc3ds, tioc4as to tioc4ds, tic5us, tic5vs, tic5ws, sck0 to sck2, rxd0 to rxd2, ssck, scs , ssi, sso v t+ ?v t? 0.4 ? ? v input leak current all input pins (except hstby ) | i in | ? ? 1.0 a input pull-up mos current hstby ?i pu ? ? 800 a v in = 0 v
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1021 of 1080 rej09b0230-0300 item symbol min. typ. max. unit test conditions three-state leak current (off state) ports a, b, d, e | i tsi | ? ? 1.0 a all output pins pv cc ? 0.8 ? ? v i oh = ?2 ma output high- level voltage v oh pv cc ? 0.5 ? ? v i oh = ?200 a all output pins ? ? 0.5 v i ol = 2 ma output low- level voltage v ol ? ? 0.4 v i ol = 1.6 ma input capacitance all input pins c in ? ? 20 pf v in = 0 v f = 1 mhz ta = 25 c normal operation i cc ? 100 135 ma i = 80 mhz b = 40 mhz p = 40 mhz mp = 40 mhz mi = 80 mhz sleep i cc ? 80 120 ma b = 40 mhz p = 40 mhz mp = 40 mhz mi = 80 mhz i cc ? 40 60 ma t a 50 c software standby i cc ? ? 70 ma 50 c < t a i cc ? 6 30 a t a 50 c supply current deep software standby and hardware standby i cc ? ? 100 a 50 c < t a during a/d conversion ? 9 15 ma contains ai refh analog power supply current waiting for a/d conversion ai cc ? ? 3 ma standby ? ? 150 a [operating precautions] 1. when the a/d converter is not used, do not leave the av cc , av ss , av refh , and av refl pins open. 2. the supply current is measured when v ih (min.) = pv cc ? 0.5 v, v il (max.) = 0.5 v, with all output pins unloaded.
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1022 of 1080 rej09b0230-0300 table 25.3 dc characteristics (wide-range specifications) conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. typ. max. unit test conditions res , hstby , nmi, fwe, md1, md0, extal v ih pv cc ? 0.6 ? pv cc +0.3 v analog pins 2.2 ? av cc +0.3 v input high-level voltage (except schmitt trigger input voltage) other input pins 2.2 ? pv cc +0.3 v res , hstby , nmi, fwe, md1, md0, extal ? 0.3 ? 0.4 v input low-level voltage (except schmitt trigger input voltage) other input pins v il ? 0.3 ? 0.8 v v t+ pv cc ? 0.5 ? ? v v t? ? ? 1.0 v schmitt trigger input voltage irq3 to irq0, poe0 to poe2 , poe4 to poe6 , poe8 , tclka to tclkd, tioc0a to tioc0d, tioc1a, tioc1b, tioc2a, tioc2b, tioc3a to tioc3d, tioc4a to tioc4d, tioc3bs, tioc3ds, tioc4as to tioc4ds, tic5us, tic5vs, tic5ws, sck0 to sck2, rxd0 to rxd2, ssck, scs , ssi, sso v t+ ?v t? 0.4 ? ? v input leak current all input pins (except hstby ) | i in | ? ? 1.0 a input pull-up mos current hstby ?i pu ? ? 800 a v in = 0 v three-state leak current (off state) ports a, b, d, e | i tsi | ? ? 1.0 a
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1023 of 1080 rej09b0230-0300 item symbol min. typ. max. unit test conditions all output pins pv cc ? 0.8 ? ? v i oh = ?2 ma output high- level voltage v oh pv cc ? 0.5 ? ? v i oh = ?200 a all output pins ? ? 0.5 v i ol = 2 ma output low- level voltage v ol ? ? 0.4 v i ol = 1.6 ma input capacitance all input pins c in ? ? 20 pf v in = 0 v f = 1 mhz ta = 25 c normal operation i cc ? 83 116 ma i = 64 mhz b = 32 mhz p = 32 mhz mp = 32 mhz mi = 64 mhz sleep i cc ? 65 105 ma b = 32 mhz p = 32 mhz mp = 32 mhz mi = 64 mhz i cc ? 40 60 ma t a 50 c software standby i cc ? ? 70 ma 50 c < t a i cc ? 6 30 a t a 50 c supply current deep software standby and hardware standby i cc ? ? 100 a 50 c < t a during a/d conversion ? 8 13 ma contains ai refh analog power supply current waiting for a/d conversion ai cc ? ? 3 ma standby ? ? 150 a [operating precautions] 1. when the a/d converter is not used, do not leave the av cc , av ss , av refh , and av refl pins open. 2. the supply current is measured when v ih (min.) = pv cc ? 0.5 v, v il (max.) = 0.5 v, with all output pins unloaded. 3. use the board more than four layers to improve the heat radiation of this lsi.
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1024 of 1080 rej09b0230-0300 table 25.4 permitted output current values conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. typ. max. unit output low-level permissible current (per pin) i ol ? ? 2.0 ma output low-level permissible current (total) i ol ? ? 80 ma output high-level permissible current (per pin) ?i oh ? ? 2.0 ma output high-level permissible current (total) ?i oh ? ? 25 ma [operating precaution] to assure lsi reliability, do not exceed the output values listed in this table.
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1025 of 1080 rej09b0230-0300 25.3 ac characteristics signals input to this lsi are basically handled as signals in synchronization with a clock. the setup and hold times for input pins must be followed. table 25.5 maximum operating frequency conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. typ. max. unit remarks regular specifications 10 ? 80 cpu (i ) wide-range specifications 10 ? 64 regular specifications 10 ? 40 external bus (b ) wide-range specifications 10 ? 32 regular specifications f 10 ? 40 mhz peripheral module (p ) wide-range specifications 10 ? 32 regular specifications 10 ? 40 mtu2 (mp ) wide-range specifications 10 ? 32 operating frequency mtu2s (mi ) regular specifications 10 ? 80 wide-range specifications 10 ? 64
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1026 of 1080 rej09b0230-0300 25.3.1 clock timing table 25.6 clock timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure extal clock input frequency f ex 8 10 mhz extal clock input cycle time t excyc 100 125 ns extal clock input low pulse width t exl 30 ? ns extal clock input high pulse width t exh 30 ? ns extal clock input rise time t exr ? 5 ns extal clock input fall time t exf ? 5 ns figure 25.1 regular specifications 16 40 mhz ck clock output frequency wide-range specifications f op 16 32 mhz regular specifications 25 62.5 ns ck clock output cycle time wide-range specifications t cyc 31.25 62.5 ns ck clock output low pulse width t ckl 1/2t cyc ? 7.5 ? ns ck clock output high pulse width t ckh 1/2t cyc ? 7.5 ? ns ck clock output rise time t ckr ? 5 ns ck clock output fall time t ckf ? 5 ns figure 25.2 power-on oscillation settling time t osc1 10 ? ms figure 25.3 standby return oscillation settling time 1 t osc2 10 ? ms figure 25.4 standby return oscillation settling time 2 t osc3 10 ? ms figure 25.5
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1027 of 1080 rej09b0230-0300 t exh t exf t exr t exl t excyc v ih v ih v ih 1/2 v cc 1/2 v cc v il v il extal (input) figure 25.1 extal clock input timing t cyc t ckl t ckh v oh 1/2v cc ck (output) 1/2v cc t ckr t ckf v oh v ol v ol v oh figure 25.2 ck clock output timing v cc (min.) t resw t ress t osc1 v cc res v ih hstby pv cc (min.) pv cc t osc1 oscillation settlin g time ck, internal clock figure 25.3 power-on oscillation settling timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1028 of 1080 rej09b0230-0300 standby period t osc2 t resw , t mresw res , mres ck, internal clock oscillation settlin g time figure 25.4 oscillation settling timing on return from standby (return by reset) standby period ck, internal clock oscillation settlin g time t osc3 nmi, irq figure 25.5 oscillation settling timing on return from standby (return by nmi or irq)
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1029 of 1080 rej09b0230-0300 25.3.2 control signal timing table 25.7 control signal timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure res pulse width t resw 20 * 2 ? t bcyc * 4 figures 25.3, 25.4, res setup time * 1 t ress 65 ? ns 25.6, 25.7 res hold time t resh 15 ? ns mres pulse width t mresw 20 * 3 ? t bcyc * 4 mres setup time * 1 t mress 25 ? ns mres hold time t mresh 15 ? ns md1, md0, fwe setup time t mds 20 ? t bcyc * 4 figure 25.6 breq setup time t breqs 1/2t bcyc + 15 ? ns figure 25.9 breq hold time t breqh 1/2t bcyc + 10 ? ns nmi setup time * 1 t nmis 60 ? ns figure 25.7 nmi hold time t nmih 10 ? ns irq3 to irq0 setup time * 1 t irqs 35 ? ns irq3 to irq0 hold time t irqh 35 ? ns irqout output delay time t irqod ? 100 ns figure 25.8 back delay time t backd ? 1/2t bcyc + 20 ns figures 25.9, 25.10 bus tri-state delay time t boff 0 100 ns bus buffer on time t bon 0 100 ns notes: 1. the res , mres , nmi, breq , and irq3 to irq0 signals are asynchronous signals. when the setup time is satisfied, change of signal level is detected at the rising edge of the clock. if not, the detection is delayed until the rising edge of the clock. 2. in standby mode, t resw = t osc2 (10 ms). 3. in standby mode, t mresw = t osc2 (10 ms). 4. t bcyc indicates external bus clock cycle time (b = ck).
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1030 of 1080 rej09b0230-0300 t ress t mds t ress t resw ck md1, md0, fwe res mres t mresw t mress t mress figure 25.6 reset input timing ck res t resh t ress v ih v il mres t mresh t mress v ih v il nmi t nmih t nmis v ih v il irq3 to irq0 t irqh t irqs v ih v il figure 25.7 interrupt signal input timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1031 of 1080 rej09b0230-0300 t irqod t irqod ck i rqout figure 25.8 interrupt signal output timing ck breq back a19 to a0 , d7 to d0 breqh t breqs t backd t backd t breqh t breqs t bon t boff t figure 25.9 bus release timing ck t boff t bon normal mode standby mode normal mode a19 to a0, d7 to d0 figure 25.10 pin driving timing in standby mode
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1032 of 1080 rej09b0230-0300 25.3.3 ac bus timing table 25.8 bus timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure address delay time 1 t ad1 1 30 ns figures 25.11 to 25.15 address setup time t as 0 ? ns figures 25.11 to 25.14 address hold time t ah 0 ? ns figures 25.11 to 25.14 cs delay time t csd 1 30 ns figures 25.11 to 25.15 read write delay time t rwd 1 30 ns figures 25.11 to 25.15 read strobe delay time t rsd 1/2t bcyc + 1 1/2t bcyc + 30 ns figures 25.11 to 25.15 read data setup time 1 t rds1 1/2t bcyc + 30 ? ns figures 25.11 to 25.15 read data hold time 1 t rdh1 0 ? ns figures 25.11 to 25.15 read data access time t acc * 2 t bcyc (n + 1.5) ? 35 * 1 ? ns figures 25.11 to 25.15 access time from read strobe t oe * 2 t bcyc (n + 1) ? 35 * 1 ? ns figures 25.11 to 25.15 write strobe delay time 1 t wsd1 1/2t bcyc + 1 1/2t bcyc + 30 ns figures 25.11 to 25.15 write data delay time 1 t wdd1 ? 30 ns figures 25.11 to 25.15
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1033 of 1080 rej09b0230-0300 item symbol min. max. unit reference figure write data hold time 1 t wdh1 1 ? ns figures 25.11 to 25.15 write data hold time t wrh 0 ? ns figures 25.11 to 25.14 wait setup time t wts 1/2t bcyc + 20 ? ns figures 25.12 to 25.15 wait hold time t wth 1/2t bcyc + 20 ? ns figures 25.12 to 25.15 notes: t bcyc indicates external bus clock period (b = ck). 1. n denotes the number of wait cycles. 2. if the access time conditions are satisfied, the t rds1 condition does not need to be satisfied. t rsd t css t csh t csh t oe t acc t1 t ad1 t as t csd t2 t ad1 t csd t rsd t ah t rdh1 t rds1 t wsd1 t wsd1 t ah t wdh1 t wdd1 t wrh read write ck a19 to a0 csn rd d7 to d0 wrl d7 to d0 figure 25.11 basic bus timi ng for normal space (no wait)
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1034 of 1080 rej09b0230-0300 t rsd t css t csh t csh t oe t acc t wth t1 t ad1 t as t csd tw t2 t ad1 t csd t rsd t ah t rdh1 t rds1 t wsd1 t wsd1 t ah t wts t wdh1 t wdd1 t wrh read write ck a19 to a0 csn rd d7 to d0 wrl wait d7 to d0 figure 25.12 basic bus timing for no rmal space (one softw are wait cycle)
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1035 of 1080 rej09b0230-0300 t rsd t css t csh t csh t oe t acc t1 t ad1 t as t csd tw x t2 t ad1 t csd t rsd t ah t rdh1 t rds1 t wsd1 t wsd1 t ah t wth t wts t wth t wts t wdh1 t wdd1 t wrh read write ck a19 to a0 csn rd d7 to d0 wrl wait d7 to d0 figure 25.13 basic bus timing for no rmal space (one ext ernal wait cycle)
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1036 of 1080 rej09b0230-0300 t wsd1 t oe t acc t oe t acc t rdh1 t css t css t csh t csh t csh t csh t wsd1 t ad1 t ad1 t1 t rsd t wsd1 t wsd1 t rds1 t rds1 t rdh1 t as t wrh t wrh t rsd t rsd t ah t rsd t ah t ah t ah t csd t wdd1 t wdh1 t wdh1 t wdd1 t csd t csd t csd t as t ad1 t ad1 tw t2 ta w t1 tw t2 taw t wth t wts t wth t wts read write a19 to a0 d7 to d0 csn rd wait d7 to d0 wrl ck figure 25.14 basic bus timing for normal space (one software wait cycle, ex ternal wait cycle valid (wm bit = 0), no idle cycle)
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1037 of 1080 rej09b0230-0300 t oe t acc th t ad1 t rsd t rsd t rds1 t csd t1 twx t2 tf t wdd1 t wdh1 t rdh1 t ad1 t csd t wts t wts t wsd1 t wsd1 t wth t wth read write ck a19 to a0 csn wrl rd d7 to d0 d7 to d0 wait figure 25.15 cs extended bus cycle for normal space (sw = 1 cycle, hw = 1 cycle, one external wait cycle)
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1038 of 1080 rej09b0230-0300 25.3.4 multi function timer pulse unit 2 (mtu2) timing table 25.9 multi function timer pulse unit 2 (mtu2) timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure output compare output delay time t tocd ? 50 ns figure 25.16 input capture input setup time t tics 20 ? ns input capture input pulse width (single edge) t ticw 1.5 ? t mpcyc input capture input pulse width (both edges) t ticw 2.5 ? t mpcyc timer input setup time t tcks 20 ? ns figure 25.17 timer clock pulse width (single edge) t tckwh/l 1.5 ? t mpcyc timer clock pulse width (both edges) t tckwh/l 2.5 ? t mpcyc timer clock pulse width (phase counting mode) t tckwh/l 2.5 ? t mpcyc note: t mpcyc indicates the mtu2 clock (mp ) cycle. output compare output input capture input ck t tocd t tics t ticw figure 25.16 mtu2 input/output timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1039 of 1080 rej09b0230-0300 ck tclka to tclkd t tcks t tcks t tckwh t tckwl figure 25.17 mtu2 clock input timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1040 of 1080 rej09b0230-0300 25.3.5 multi function timer pulse unit 2s (mtu2s) timing table 25.10 multi function timer pulse unit 2s (mtu2s) timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure output compare output delay time t tocd ? 50 ns figure 25.18 input capture input setup time t tics 20 ? ns input capture input pulse width (single edge) t ticw 1.5 ? t micyc input capture input pulse width (both edges) t ticw 2.5 ? t micyc note: t micyc indicates the mtu2s clock (mi ) cycle. output compare output input capture input note: * when the mi frequency is higher than the b frequency, mi is used instead of ck. ck * t tocd t tics t ticw figure 25.18 mtu2s input/output timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1041 of 1080 rej09b0230-0300 25.3.6 i/o port timing table 25.11 i/o port timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure port output data delay time t pwd ? 50 ns figure 25.19 port input hold time t prh 20 ? ns port input setup time t prs 20 ? ns t prs t prh t pwd ck port (read) port (write) figure 25.19 i/o port input/output timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1042 of 1080 rej09b0230-0300 25.3.7 watchdog timer (wdt) timing table 25.12 watchdog timer (wdt) timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure wdtovf delay time t wovd ? 50 ns figure 25.20 t wovd t wovd v oh v oh ck w dtovf figure 25.20 wdt timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1043 of 1080 rej09b0230-0300 25.3.8 serial communication in terface (sci) timing table 25.13 serial communication interface (sci) timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure input clock cycle (asynchronous) t scyc 4 ? t pcyc input clock cycle (clock synchronous) t scyc 6 ? t pcyc figure 25.21 input clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr ? 1.5 t pcyc input clock fall time t sckf ? 1.5 t pcyc transmit data delay time t txd ? 4 t pcyc + 10 ns receive data setup time t rxs 4 t pcyc ? ns receive data hold time asynchronous t rxh 4 t pcyc ? ns transmit data delay time t txd ? 3 t pcyc + 10 ns receive data setup time clock synchronous t rxs 3 t pcyc + 50 ? ns figure 25.22 receive data hold time t rxh 3 t pcyc + 50 ? ns note: t pcyc indicates the peripheral clock (p ) cycle. t sckw v ih v ih v ih v ih v il v il v il sck0 to sck2 t sckr t sckf t scyc figure 25.21 input clock timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1044 of 1080 rej09b0230-0300 t scyc sck0 to sck2 (input/output) txd0 to txd2 (transmit data) rxd0 to rxd2 (receive data) sci input/output timing (clock synchronous mode) t txd t rxs t rxh v oh v oh t1 ck txd0 to txd2 (transmit data) rxd0 to rxd2 (receive data) sci input/output timing (asynchronous mode) tn t txd t rxs t rxh figure 25.22 sci input/output timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1045 of 1080 rej09b0230-0300 25.3.9 synchronous serial communication unit timing table 25.14 synchronous serial communication unit timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure master 4 256 clock cycle slave t sucyc 4 256 t pcyc master 60 ? clock high pulse width slave t hi 60 ? ns master 60 ? clock low pulse width slave t lo 60 ? ns clock rise time t rise ? 20 ns clock fall time t fall ? 20 ns master 25 ? data input setup time slave t su 30 ? ns master 10 ? data input hold time slave t h 10 ? ns master 1.5 ? scs setup time slave t lead 1.5 ? t pcyc master 1.5 ? scs hold time slave t lag 1.5 ? t pcyc master ? 40 data output delay time slave t od ? 40 ns data output hold time master t oh 30 ? ns figures 25.23 to 25.26 slave 30 ?
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1046 of 1080 rej09b0230-0300 item symbol min. max. unit reference figure master 1.5 ? continuous transmission delay time slave t td 1.5 ? t pcyc figures 25.23 to 25.26 slave access time t sa ? 1 t pcyc slave out release time t rel ? 1 t pcyc figures 25.26, 25.27 note: t pcyc indicates the peripheral clock (p ) cycle.
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1047 of 1080 rej09b0230-0300 ssck (output) cpos = 0 scs (output) ssck (output) cpos = 1 sso (output) ssi (input) t lead t su t h t od t fall t rise t sucyc t lag t oh t lo t hi t hi t lo t td figure 25.23 synchronous serial communication unit timing (master, cphs = 1) ssck (output) cpos = 0 scs (output) ssck (output) cpos = 1 sso (output) ssi (input) t lead t su t h t od t fall t rise t sucyc t lag t oh t lo t hi t hi t lo t td figure 25.24 synchronous serial communication unit timing (master, cphs = 0)
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1048 of 1080 rej09b0230-0300 ssck (input) cpos = 0 scs (input) ssck (input) cpos = 1 sso (input) ssi (output) t lead t fall t rise t sucyc t lag t td t rel t oh t od t su t sa t lo t hi t hi t lo t h figure 25.25 synchronous serial communication unit timing (slave, cphs = 1) ssck (input) cpos = 0 scs (input) ssck (input) cpos = 1 sso (input) ssi (output) t lead t fall t rise t sucyc t lag t td t rel t oh t od t su t sa t lo t hi t hi t lo t h figure 25.26 synchronous serial communication unit timing (slave, cphs = 0)
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1049 of 1080 rej09b0230-0300 25.3.10 controller area network (rcan-et) timing table 25.15 shows rcan-et timing. table 25.15 controller area network (rcan-et) timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure transmit data delay time t ctxd ? 100 ns figure 25.27 receive data setup time t crxs 100 ? ns receive data hold time t crxh 100 ? ns v oh v oh ck ctx (transmit data) crx (receive data) t ctxd t crxs t crxh figure 25.27 rcan-et input/output timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1050 of 1080 rej09b0230-0300 25.3.11 port output enable (poe) timing table 25.16 port output enable (poe) timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure poe input setup time t poes 50 ? ns figure 25.28 poe input pulse width t poew 1.5 ? t pcyc note: t pcyc indicates the peripheral clock (p ) cycle. ck p oen input t poes t poew figure 25.28 poe input timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1051 of 1080 rej09b0230-0300 25.3.12 ubc trigger timing table 25.17 ubc trigger timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit reference figure ubctrg delay time t ubctgd ? 150 ns figure 25.29 v oh ck ubctrg t ubctgd figure 25.29 ubc trigger timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1052 of 1080 rej09b0230-0300 25.3.13 a/d converter timing table 25.18 a/d converter timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. typ. max. unit figure external trigger input start delay time t trgs 25 ? ? ns figure 25.30 ck adtrg input t trgs v oh figure 25.30 external trigger input timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1053 of 1080 rej09b0230-0300 25.3.14 aud timing table 25.19 shows aud timing. table 25.19 aud timing conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item symbol min. max. unit figure audrst pulse width (branch trace) t audrstw 20 ? t bcyc audrst pulse width (ram monitor) t audrstw 5 ? t rmcyc audmd setup time (branch trace) t audmds 20 ? t bcyc audmd setup time (ram monitor) t audmds 5 ? t rmcyc figure 25.31 branch trace clock cycle t btcyc 2 2 ns branch trace clock duty t btckw 40 60 % branch trace data delay time t btdd ? 50 ns branch trace data hold time t btdh 50 ? ns branch trace sync delay time t btsd ? 50 ns branch trace sync hold time t btsh 50 ? ns figure 25.32 ram monitor clock cycle t rmcyc 100 ? ns ram monitor clock low pulse width t rmckw 42 ? ns ram monitor output data delay time t rmdd 5 t rmcyc -20 ns ram monitor output data hold time t rmdhd 50 ? ns ram monitor input data setup time t rmds 50 ? ns ram monitor input data hold time t rmdh 50 ? ns ram monitor sync setup time t rmss 50 ? ns figure 25.33 ram monitor sync hold time t rmsh 50 ? ns load conditions: audck (output): cl = 30 pf audsync : cl = 30 pf audata3 to audata0: cl = 30 pf
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1054 of 1080 rej09b0230-0300 t rmcyc t audrstw t audmds t bcyc ck (branch trace) audck (input) (ram monitor) audrst audmd figure 25.31 aud reset timing audck (output) audata3 to audata0 (output) audsync (output) t btdd t btsd t btckw t btcyc t btdh t btsh figure 25.32 branch trace timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1055 of 1080 rej09b0230-0300 audck (input) audata3 to audata0 (output) audata3 to audata0 (input) audsync (input) t rmdd t rmds t rmss t rmdh t rmcyc t rmckw t rmdhd t rmsh figure 25.33 ram monitor timing
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1056 of 1080 rej09b0230-0300 25.3.15 ac characteristics measurement conditions ? input signal level: v il (max.)/v ih (min.) ? output signal reference level: high level: 2.0 v, low level: 0.8 v i ol i oh c l v ref lsi output pin dut output notes: c l is the total value that includes the capacitance of measurement tools. each pin is set as follows: 20pf: ck 30pf: all other output pins test conditions include i ol = 1.6 ma and i oh = -200 a. 1. 2. figure 25.34 output load circuit
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1057 of 1080 rej09b0230-0300 25.4 a/d converter characteristics table 25.20 a/d converter characteristics conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +125 c item min. typ. max. unit resolution 12 12 12 bit regular specifications 1.25 * 1 a/d conversion time wide-range specifications ? ? 1.56 * 2 s analog input capacitance ? ? 5 pf permitted analog signal source impedance ? ? 3 k non-linear error (integral error) ? ? 4 * 3 lsb absolute accuracy * 4 ? ? 8 lsb notes: 1. conversion time per channel when the sample-and-hold circuit is not used and the a/d clock operates at 40 mhz. 2. conversion time per channel when the sample-and-hold circuit is not used and the a/d clock operates at 32 mhz. 3. non-linear error is a reference value. 4. guaranteed range from av refl + 0.25 v to av refh ? 0.25 v.
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1058 of 1080 rej09b0230-0300 25.5 flash memory characteristics table 25.21 flash memory characteristics conditions (regular specifications): v cc = 4.5 v to 5.5 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c conditions (wide-range specifications): v cc = 3.0 v to 3.6 v, pv cc = 4.5 v to 5.5 v, av cc = 4.5 v to 5.5 v, av refh = 4.5 v to av cc , v ss = pllv ss = av ss = av refh = 0 v, t a = ?40 c to +85 c* 6 item symbol min. typ. max. unit programming time * 1 * 2 * 4 t p ? 1 10 ms/128 bytes erase time * 1 * 3 * 5 t e ? 8 25 ms/kbyte reprogramming count n wec ? ? 100 times notes: 1. use the on-chip programming/erasing routine for programming/erasure. 2. when all 0 are programmed. 3. when a block is 64 kbytes. 4. the total reprogramming times (programming time + erase time) are as follows: 256-kbyte version: 60 s (typ.), 90 s (reference value), 120 s (max.) 384-kbyte version: 90 s (typ.), 120 s (reference value), 180 s (max.) 512-kbyte version: 120 s (typ.), 180 s (reference value), 240 s (max.) however, 90% of the values are within the reference value. 5. t e distributes focusing on near the typ. value. 6. programming/erasure only: 85 c normal operation except for programming/erasure: 125 c
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1059 of 1080 rej09b0230-0300 25.6 usage note 25.6.1 notes on connecting v cl capacitor this lsi includes an internal step-down circuit to automatically reduce the internal power supply voltage to an appropriate level. between this internal stepped-down power supply (v cl pin) and the v ss pin, a capacitor (0.47 f) for stabilizing the internal voltage needs to be connected. connection of the external capacitor is shown in figure 25.35. the external capacitor should be located near the pin. do not apply any power supply voltage to the v cl pin. one 0.47-f capacitor one 0.47-f capacitor v cl v ss v cl v ss externally connected capacitors for power-supply stabilization do not apply any power supply voltage to the v cl pin. use multilayer ceramic capacitors (one 0.47-f capacitor for each v cl pin), which should be located near the pin. note: figure 25.35 connection of v cl capacitor
section 25 electrical characteristics rev. 3.00 oct. 06, 2008 page 1060 of 1080 rej09b0230-0300
appendix rev. 3.00 oct. 06, 2008 page 1061 of 1080 rej09b0230-0300 appendix a. pin states pin initial states differ according to mcu operating modes. refer to section 18, pin function controller (pfc), for details. table a.1 pin states pin function pin state reset state power-down state power-on type pin name expansion without rom expansion with rom single- chip manual hardware standby deep software standby software standby sleep bus master- ship release oscillation stop detected poe function used ck o z o z z h * 1 o o o o xtal o o l l l o o o o clock extal i i z z i i i i i res i i i i i i i i i mres z i z z z i i z i wdtovf o * 3 o o o o o o o o breq z i z z z i i i i system control back z o z z z o l o o md0, md1 i i i i i i i i i hstby i * 4 i * 4 i i i * 4 i * 4 i * 4 i * 4 i * 4 operating mode control fwe i i i i i i i i i nmi i i z i i i i i i irq0 to irq3 z i z z i i i i i interrupt irqout z o z z z o o z o a0 to a17 o z o z z z * 2 o z o o address bus a18, a19 z o z z z * 2 o z o o data bus d0 to d7 z i/o z z z i/o z i/o i/o
appendix rev. 3.00 oct. 06, 2008 page 1062 of 1080 rej09b0230-0300 pin function pin state reset state power-down state power-on type pin name expansion without rom expansion with rom single- chip manual hardware standby deep software standby software standby sleep bus master- ship release oscillation stop detected poe function used bus control wait z i z z z i z i i cs0 (pe10) h z o z z z * 2 o z o o cs0 (pe17), cs1 z o z z z * 2 o z o o rd (pa6) h z o z z z * 2 o z o o rd (pe19) z o z z z * 2 o z o o wrl (pa8) h z o z z z * 2 o z o o wrl (pe21) z o z z z * 2 o z o o mtu2 tclka to tclkd z i z z z i i i i tioc0a to tioc0d z i/o z z k * 1 i/o i/o i/o z tioc1a, tioc1b z i/o z z k * 1 i/o i/o i/o i/o tioc2a, tioc2b z i/o z z k * 1 i/o i/o i/o i/o tioc3a, tioc3c z i/o z z k * 1 i/o i/o i/o i/o tioc3b, tioc3d z i/o z z z i/o i/o z z tioc4a to tioc4d z i/o z z z i/o i/o z z mtu2s tioc3bs, tioc3ds z i/o z z z i/o i/o z z tioc4as to tioc4ds z i/o z z z i/o i/o z z tic5us, tic5vs, tic5ws z i z z z i i i i
appendix rev. 3.00 oct. 06, 2008 page 1063 of 1080 rej09b0230-0300 pin function pin state reset state power-down state power-on type pin name expansion without rom expansion with rom single- chip manual hardware standby deep software standby software standby sleep bus master- ship release oscillation stop detected poe function used poe poe0 to poe2 , poe4 to poe6 , poe8 z i z z z i i i i sci sck0 to sck2 z i/o z z z i/o i/o i/o i/o rxd0 to rxd2 z i z z z i i i i txd0 to txd2 z o z z o * 1 o o o o ssck z i/o z z z i/o i/o i/o i/o scs z i/o z z z i/o i/o z i/o ssi z i/o z z z i/o i/o i/o i/o synchronous serial communica- tion unit sso z i/o z z z i/o i/o i/o i/o ubc ubctrg z o z z o * 1 o o o o ctx0 z o z z o * 1 o o o o crx0 z i z z z i i i i ctx1 z o z z o * 1 o o o o rcan-et crx1 z i z z z i i i i an0 to an15 z i z z z i i i i a/d converter adtrg z i z z z i i i i i/o port pa0 to pa15 z i/o z z k * 1 i/o i/o i/o i/o pb0 to pb7 z i/o z z k * 1 i/o i/o i/o i/o pd0 to pd10 z i/o z z k * 1 i/o i/o i/o i/o pe0 to pe3 z i/o z z k * 1 i/o i/o i/o z pe4 to pe8, pe10 z i/o z z k * 1 i/o i/o i/o i/o pe9, pe11 to pe15 z i/o z z z i/o i/o z z pe16 to pe21 z i/o z z z i/o i/o z z
appendix rev. 3.00 oct. 06, 2008 page 1064 of 1080 rej09b0230-0300 [legend] i: input o: output h: high-level output l: low-level output z: high-impedance k: input pins become high-impedance, and output pins retain their state. notes: 1. output pins become high-impedance when the hiz bit in standby control register 6 (stbcr6) is set to 1. 2. becomes output when the hizmem bit in the common control register (cmncr) is set to 1. 3. becomes input during a power-on reset. pull-up to prevent erroneous operation. pull- down with a resistance of at least 1 m as required. 4. pulled-up inside the lsi when there is no input.
appendix rev. 3.00 oct. 06, 2008 page 1065 of 1080 rej09b0230-0300 table a.2 pin state of aud pin function pin state reset state power-down state power-on type pin name expansion without rom expansion with rom single- chip aud r eset hardware standby aud module standby deep software standby software standby sleep audrst h input h input h input l input z z z z h input audmd i i i i z z z z i audata3 to audata0 audmd = h: i/o audmd = l: o audmd = h: i/o audmd = l: o audmd = h: i/o audmd = l: o audmd = h: i audmd = l: o z z z z audmd = h: i/o audmd = l: o aud auduck audmd = h: i audmd = l: o audmd = h: i audmd = l: o audmd = h: i audmd = l: o audmd = h: i audmd = l: o z z z z audmd = h: i audmd = l: o audsync audmd = h: i audmd = l: o audmd = h: i audmd = l: o audmd = h: i audmd = l: o audmd = h: i audmd = l: o z z z z audmd = h: i audmd = l: o [legend] i: input o: output h: high-level output l: low-level output z: high-impedance
appendix rev. 3.00 oct. 06, 2008 page 1066 of 1080 rej09b0230-0300 b. pin states of bus related signals table b.1 pin states of bus related signals (1) pin name on-chip rom space on-chip ram space on-chip peripheral module space cs0 , cs1 h h h r h h h rd w ? h h r h h h wrl w ? h h a19 to a0 address * address * address * d7 to d0 hi-z hi-z hi-z [legend] r: read w: write note: * value of external space address that was previously accessed table b.1 pin states of bus related signals (2) external space (normal space) pin name 8-bit space cs0 , cs1 enabled r l rd w h r h wrl w l a19 to a0 address d7 to d0 data [legend] r: read w: write enabled: chip select signals corresponding to accessed areas = low. the other chip select signals = high.
appendix rev. 3.00 oct. 06, 2008 page 1067 of 1080 rej09b0230-0300 c. list of part number table c.1 list of part number product type product name classification rom capacity ram capacity operating temperature product part no. package (package code) r5f71474bj80fpv 16 kbytes ? 40 to + 85c r5f71474bd80fpv 256 kbytes 12 kbytes ? 40 to + 125c r5f71474ak64fpv ? 40 to + 85c r5f71475bj80fpv 384 kbytes ? 40 to + 125c r5f71475ak64fpv r5f71476bj80fpv ? 40 to + 85c r5f71476bd80fpv sh7147 f-ztat version 512 kbytes 16 kbytes ? 40 to + 125c r5f71476ak64fpv 16 kbytes ? 40 to + 85c R5F71424bj80fpv 256 kbytes 12 kbytes ? 40 to + 125c R5F71424ak64fpv R5F71426bj80fpv sh7142 f-ztat version 512 kbytes 16 kbytes ? 40 to + 85c R5F71426bd80fpv lqfp-100 (fp-100uv) ? 40 to + 125c R5F71426ak64fpv
appendix rev. 3.00 oct. 06, 2008 page 1068 of 1080 rej09b0230-0300 d. package dimensions the package dimension that is shown in the renesas semiconductor package data book has priority. terminal cross section b 1 c 1 b p c 2. 1. dimensions " * 1" and " * 2" do not include mold flash. note) dimension " * 3" does not include trim offset. y index mark x 125 26 50 51 75 76 100 f * 1 *3 * 2 z e z d e d h d h e b p detail f l 1 a 2 a 1 l a c l 1 z e z d c 1 b 1 b p a 1 h e h d y0.08 e0.5 c 0 8 x l 0.35 0.5 0.65 0.05 0.1 0.15 a1.7 15.8 16.0 16.2 15.8 16.0 16.2 a 2 1.4 e 13.9 14.0 14.1 d 13.9 14.0 14.1 reference symbol dimension in millimeters min nom max 0.15 0.20 0.25 0.09 0.145 0.20 0.08 1.0 1.0 0.18 0.125 1.0 previous code jeita package code renesas code plqp0100kb-a 100p6q-a / fp-100u / fp-100uv mass[typ.] 0.6g p-lqfp100-14x14-0.50 e figure d.1 package dimensions
main revisions for this edition rev. 3.00 oct. 06, 2008 page 1069 of 1080 rej09b0230-0300 main revisions for this edition item page revision (see manual for details) 7.3.11 break control register (brcr) 139 description amended bit bit name initial value r/w description 7 dbea 0 r/w data break enable a selects whether or not the data bus value is included in the channel a break condition. 0: the data bus value is not included in the channel a break condition 1: the data bus value is included in the channel a break condition 5 dbeb 0 r/w data break enable b selects whether or not the data bus value is included in the channel b break condition. 0: the data bus value is not included in the channel b break condition 1: the data bus value is included in the channel b break condition 140 note added note: the operand size must be specified if the data bus value is included in the break condition and the interrupt cycle is specified in the break condition with the rwa and/or rwb bits. 10.1 features table 10.2 mtu2s functions 241 table amended item channel 3 channel 4 channel 5 pwm mode 1 ? ? 15.3.2 a/d status registers_0 and _1 (adsr_0 and adsr_1) 642 note added bit bit name initial value r/w description 7 to 1 all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 adf 0 r/(w) * a/d end flag a status flag that indicates the completion of a/d conversion. [setting condition] ? when a/d conversion on all specified channels is completed in scan mode [clearing conditions] ? when 0 is written after reading adf = 1 ? when the dtc is activated by an adi interrupt and addr is read note: * writing 0 to this bit after reading it as 1 clears the flag and is the only allowed way. do not overwrite this bit with 0 when the value of this bit is 0.
main revisions for this edition rev. 3.00 oct. 06, 2008 page 1070 of 1080 rej09b0230-0300 item page revision (see manual for details) 17.3.4 rcan-et mailbox registers (8) unread message status register (umsr) 715 note added bit: initial value: r/w: 151413121110987654321 0 0000000000000000 r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * umsr0[15:0] note : * only when writing a ?1? to clear. 17.4.4 message receive sequence figure 17.12 message receive sequence 726 figure amended rcan-et end of arbitration field notes: 1. only if cpu clears rxpr[n]/rfpr[n] at the same time that umsr is set in overrun, rxpr[n]/rfpr[n] may be set again eve n though the message has not been updated. 2. in case overwrite configuration (nmc = 1) is used for the mailbox n the message must be discarded when umsr[n] = 1, umsr[n] cleared and the full interrupt service routine started again. in case of overrun configuration (nmc = 0) is used clear again rxpr[n]/ rfpr[n]/ umsr[n] when umsr[n] = 1 and consider the message obsolate. can bus end of frame idle valid can-id received compare id with mailbox[n] + lafm[n] (if mbc is config to receive) store mailbox-number[n] and go back to idle state ? store message by overwriting ? set umsr ? set irr9 (if mbimr[n] = 0) ? generate interrupt signal (if imr9 = 0) ? set rxpr[n] (rfpr[n]) ? set irr1 (irr2) (if mbimr[n] = 0) ? generate interrupt signal (if imr1 (imr2) = 0) ? store message ? set rxpr[n] (rfpr[n]) ? set irr1 (irr2) (if mbimr[n] = 0) ? generate interrupt signal (if imr1 (imr2) = 0) valid can frame received write 1 to rxpr[n] read mailbox[n] irr[1] set? read irr msg overwrite or overrun? (nmc) overwrite overrun n = 0? n = n - 1 no no no no yes yes yes write 1 to rfpr[n] read mailbox[n] read rfpr[n] = 1 yes yes cpu received interrupt due to can message reception rxpr[n] (rfpr[n]) already set? id matched? interrupt signal interrupt signal interrupt signal loop (n = 15; n 0; n = n - 1) read rxpr[n] = 1 exit interrupt service routine ? reject message ? set umsr ? set irr9 (if mbimr[n] = 0) ? generate interrupt signal (if imr9 = 0) ? set rxpr[n] (rfpr[n]) * 1 check and clear umsr[n] * 2 check and clear umsr[n] * 2 18.1.8 port e control registers l1 to l4, h1, h2 (pecrl1 to pecrl4, pecrh1, pecrh2) ? port e control register h2 (pecrh2) 768 description amended bit bit name initial value r/w description 1 0 pe20md1 pe20md0 0 0 r/w r/w pe20 mode select the function of the pe20/tioc4cs pin. 00: pe20 i/o (port) 01: tioc4cs i/o (mtu2s) other than above: setting prohibited 20.4.1 registers table 20.5 register/parameter and target mode 810 table amended download initiali- zation program- ming erasure read ram emulation fccs ? ? ? ? ? fpcs ? ? ? ? ? fecs ? ? ? ? ? fkey ? ? ? fmats ? ? * 1 * 1 * 2 ? programming/ erasing interface registers ftdar ? ? ? ? ?
main revisions for this edition rev. 3.00 oct. 06, 2008 page 1071 of 1080 rej09b0230-0300 item page revision (see manual for details) 20.5.2 user program mode (4) erasing and programming procedure in user program mode figure 20.13 sample procedure of repeating ram emulation, erasing, and programming (overview) 849 figure amended 1 initialize programming program download programming program programming program download set ftdar to h'04 (specify h'ffffb000 as download destination) 850 description amended initialization must be executed for both entry addresses: (download start address for erasing program) + 32 bytes (h'ffff9020 in this example) and (download start address for programming program) + 32 bytes (h'ffffb020 in this example). 20.8.2 interrupts during programming/erasing figure 20.21 timing of contention between sco download request and interrupt request 863 figure amended n n+1 n+2 n+3 n+4 fetch decoding execution execution execution (a) (b) (2) interrupts during programming/erasing description amended interrupts during execution of write or erase operations with a downloaded on-chip program and acquisition of bus rights by bus masters other than the cpu are forbidden. 20.8.3 other notes (8) stack address 865 description added (9) illegal access areas when the ram emulation function is used description added table 20.13 illegal access areas during ram emulation function use 866 table amended eb0 selected eb1 selected eb2 selected eb3 selected eb4 selected eb5 selected eb6 selected eb7 selected h'00008000 to h'00008fff h'00009000 to h'00009fff h'0000a000 to h'0000afff h'0000b000 to h'0000bfff h'0000c000 to h'0000cfff h'0000d000 to h'0000dfff h'0000e000 to h'0000efff h'0000f000 to h'0000fff f h'00010000 to h'00010fff h'00011000 to h'00011fff h'00012000 to h'00012fff h'00013000 to h'00013fff h'00014000 to h'00014fff h'00015000 to h'00015fff h'00016000 to h'00016fff h'00017000 to h'00017ff f illegal access area
main revisions for this edition rev. 3.00 oct. 06, 2008 page 1072 of 1080 rej09b0230-0300
index rev. 3.00 oct. 06, 2008 page 1073 of 1080 rej09b0230-0300 index a a/d conversion time............................... 653 a/d converter (adc) ............................. 635 a/d converter activation......................... 426 a/d converter activation by mtu2 and mtu2s ............................................ 654 a/d converter characteristics................ 1057 a/d converter start request delaying function................................................... 409 absolute accuracy................................... 658 absolute maximum ratings................... 1019 ac bus timing....................................... 1032 ac characteristics................................. 1025 ac characteristics measurement conditions.............................................. 1056 access in view of lsi internal bus master ..................................................... 230 access size and data alignment .............. 215 access wait control................................. 219 address calculation during branch trace ........................................................ 942 address error .............................. 83, 92, 906 address map ........................................... 202 addressing modes..................................... 26 advanced user debugger (aud) ............ 925 arithmetic operation instructions ............. 39 asynchronous mode ....................... 527, 560 b block transf er mode................................ 183 boot m ode............................................... 835 branch instructions ................................... 43 branch trace............................................ 940 branch trace mode .................................. 925 break comparison conditions.................. 121 break detection and processing .............. 589 break on data access cycle...................... 146 bus arbitr ation......................................... 224 bus clock (b ) .......................................... 57 bus release state ........................................ 47 bus state controller (bsc) ...................... 199 c calculating exception handling vector table addresses ................................................... 80 can interface ......................................... 677 chain transfer.......................................... 184 changing frequency .................................. 70 clock (mi ) for the mtu2s module ........ 57 clock (mp ) for the mtu2 module ......... 57 clock frequency control circuit................. 59 clock operating mode ............................... 62 clock pulse generator (cpg) .................... 57 clock synchronou s mode ................ 527, 570 clock ti ming ......................................... 1026 cmt interrupt sources ............................ 669 compare match timer (cmt) ................. 663 complementary pwm mode .................. 365 conflict between nmi interrupt and dtc activation....................................... 197 connecting crystal resonator..................... 71 continuous scan mode ............................ 650 control signal timing ............................ 1029 controller area network (rcan-et)...... 673 cpu........................................................... 17 crystal oscillator ....................................... 59 csn assert period extension .................... 221 d data transfer controller (dtc)................ 157 data transfer instructions .......................... 37
index rev. 3.00 oct. 06, 2008 page 1074 of 1080 rej09b0230-0300 dc characteristics................................. 1020 dead time compensation ........................ 420 deep software standby mode.................. 921 definitions of a/d conversion accuracy.................................................. 658 divider...................................................... 59 dtc activation ....................................... 425 dtc activation by interrupt.................... 192 dtc activation sources .......................... 169 dtc bus release timing .......................... 189 dtc execution status.............................. 187 dtc interface ......................................... 731 dtc vector address ................................ 171 e error protection ...................................... 856 exception handling ................................... 77 exception handling state........................... 47 external clock input method ..................... 72 external pulse width measurement ......... 419 external trigger input timing .................. 655 f features of instructions............................. 23 flash memory......................................... 797 flash memory characteristics ............... 1058 flash memory configuration................... 803 flash memory emulation in ram .......... 858 flow of the user break operation ............ 144 full trace mode ....................................... 944 full-scale error........................................ 658 function for detecting oscillator stop ....... 73 g general illegal instructions ....................... 88 general registers ....................................... 19 global-base register (gbr) ...................... 20 h halt mode................................................ 719 hardware protection................................ 855 i i/o ports .................................................. 779 id reorder .............................................. 688 illegal slot instructions.............................. 88 immediate data formats............................. 23 initial user branch processing time ......... 864 initial values of control register ................ 21 initial values of general register................ 21 initial values of system register ................ 21 initiation intervals of user branch processing ............................................... 864 input sampling and a/d conversion time ......................................................... 652 instruction formats .................................... 29 instruction set............................................ 33 interrupt controller (intc) ....................... 95 interrupt exception handling vector able.......................................................... 109 interrupt priority ....................................... 86 interrupt response time ........................... 117 interrupt se quence................................... 113 interrupts................................................... 85 irq interrupts ......................................... 107 l list of aud bus commands ................... 938 list of registers ....................................... 953 local acceptance filter mask (lafm) .... 685 location of transfer information and dtc vector table..................................... 169
index rev. 3.00 oct. 06, 2008 page 1075 of 1080 rej09b0230-0300 logic operation instructions ..................... 41 m mailbox................................................... 676 mailbox control ...................................... 676 mailbox structure.................................... 680 manual reset ............................................. 82 mcu extension mode ............................... 51 mcu operating modes.............................. 49 message control field.............................. 681 message data fields................................. 686 message receive sequence ...................... 726 message transmission sequence.............. 723 micro processor interface (mpi)............. 676 module stan dby m ode............................. 922 module standby mode setting ........ 196, 591, ................................................ 633, 670, 906 mtu2 functions ..................................... 237 mtu2 interrupts ..................................... 424 mtu2 output pin initialization ............... 456 mtu2?mtu2s synchronous operation ................................................. 413 mtu2s functions ................................... 241 multi-function timer pulse unit 2 (mtu2) and multi-function timer pulse unit 2s (mtu 2s) ........................................... 235 multiply and accumulate registers (mach and macl) ................................ 21 multiprocessor communication function................................................... 579 n nmi interrupt.......................................... 107 nonlinearity error ................................... 658 normal space interface ........................... 216 normal transf er mode ............................. 180 note on changing operating mode ............ 56 note on crystal resonator .......................... 74 notes on board design....................... 74, 660 notes on connecting v cl capacitor ....... 1059 notes on noise countermeasures ............. 660 notes on register access (wdt) ............. 523 notes on slot illegal instruction exception handling .................................... 93 o offset error.............................................. 658 on-board progra mming mode................. 835 on-chip peripheral module interrupts ..... 108 operating clock for each module .............. 60 p package dimensions .............................. 1068 pc trace................................................... 148 peripheral clock (p )................................. 57 pin function controller (pfc).................. 735 pin states of bus related signals............. 1066 pin states of this lsi in each processing state ..................................... 1061 port output enable (poe) ........................ 489 power-down modes................................. 907 power-down state...................................... 47 power-on reset .......................................... 81 procedure register (pr)............................. 21 product code lineup............................... 1067 program counter (pc) ............................... 21 program execution state ............................ 47 programmer mode................................... 904 q quantization error ................................... 658
index rev. 3.00 oct. 06, 2008 page 1076 of 1080 rej09b0230-0300 r ram ....................................................... 905 ram monito r mode................................ 949 rcan-et bit rate calculation ................ 698 rcan-et interrupt sources ................... 730 rcan-et memory map......................... 678 rcan-et reset sequence....................... 718 real-time trace mode.............................. 943 reconfiguration of mailbox ................... 728 register aback0 ............................................ 712 adansr_0 and adansr_1............ 645 adcr_0 and adcr_1 ...................... 639 addr0 to addr15 .......................... 646 adsr_0 and adsr_1 ....................... 642 adstrgr_0 and adstrgr_1 ....... 643 aucsr............................................... 929 auecsr ............................................ 935 auwaer........................................... 933 auwasr........................................... 933 auwber........................................... 934 auwbsr ........................................... 934 bamra ............................................. 125 bamrb.............................................. 131 bara ................................................. 125 barb ................................................. 130 bbra ................................................. 126 bbrb ................................................. 134 bcr0, bcr1 ...................................... 695 bdmra ............................................. 129 bdmrb.............................................. 133 bdra ................................................. 128 bdrb ................................................. 132 betr.................................................. 141 brcr ................................................. 136 brdr ................................................. 143 brsr.................................................. 142 bscehr..................................... 168, 214 cmcnt .............................................. 667 cmcor.............................................. 667 cmcsr............................................... 665 cmncr .............................................. 207 cmstr............................................... 665 cra .................................................... 164 crb .................................................... 165 cs0bcr and cs1bcr ....................... 209 cs0wcr and cs1wcr ..................... 212 dar (dtc) ........................................ 163 dpfr .................................................. 820 dtccr ............................................... 167 dtcera to dtcere ........................ 166 dtcvbr ............................................ 168 fccs................................................... 811 febs ................................................... 830 fecs................................................... 814 fkey .................................................. 815 fmats ............................................... 816 fmpar............................................... 825 fmpdr............................................... 826 fpcs ................................................... 814 fpefeq .............................................. 821 fpfr ................................... 824, 827, 831 frqcr ................................................. 66 ftdar ............................................... 817 fubra ............................................... 822 gsr..................................................... 693 icr0...................................................... 99 icsr1 ................................................. 493 icsr2 ................................................. 498 icsr3 ................................................. 503 imr..................................................... 705 ipra, iprd to iprf and iprh to iprm................................................... 104 irqcr ................................................ 100 irqsr................................................. 101 irr...................................................... 700 mbimr0............................................. 714 mcr ................................................... 687 mra ................................................... 160 mrb ................................................... 161
index rev. 3.00 oct. 06, 2008 page 1077 of 1080 rej09b0230-0300 ocsr1................................................ 496 ocsr2................................................ 501 osccr ................................................. 69 pacrl1 ............................................. 748 pacrl2 ............................................. 748 pacrl3 ............................................. 748 pacrl4 ............................................. 748 padrl ............................................... 781 paiorl.............................................. 747 paprl................................................ 783 pbcrl1.............................................. 757 pbcrl2.............................................. 757 pbdrl ............................................... 785 pbiorl .............................................. 756 pbprl ................................................ 786 pdcrl1 ............................................. 762 pdcrl2 ............................................. 762 pdcrl3 ............................................. 762 pddrl ............................................... 788 pdiorl.............................................. 761 pdprl................................................ 790 pecrh1 ............................................. 768 pecrh2 ............................................. 768 pecrl1.............................................. 768 pecrl2.............................................. 768 pecrl3.............................................. 768 pecrl4.............................................. 768 pedrh ............................................... 792 pedrl................................................ 792 peiorh.............................................. 767 peiorl .............................................. 767 peprh................................................ 795 peprl ................................................ 795 poecr1 ............................................. 506 poecr2 ............................................. 508 ramcr .............................................. 917 ramer .............................................. 833 rec .................................................... 705 rfpr0 ................................................ 713 rxpr0................................................ 712 sar (dtc) ......................................... 163 scbrr (s ci)...................................... 547 scrdr ............................................... 531 scrsr (sci) ...................................... 531 scscr (sci) ...................................... 535 scsdcr ............................................. 546 scsmr (sci) ..................................... 532 scsptr (sci) .................................... 544 scssr ................................................ 538 sctdr................................................ 532 sctsr (sci) ...................................... 531 spoer ................................................ 505 sscr2................................................. 606 sscrh................................................ 597 sscrl ................................................ 599 sser ................................................... 602 ssmr.................................................. 600 ssrdr0 to ssrdr3 .......................... 608 sssr ................................................... 603 sstdr0 to sstdr3........................... 607 sstrsr .............................................. 609 stbcr1.............................................. 910 stbcr2.............................................. 911 stbcr3.............................................. 912 stbcr4.............................................. 914 stbcr5.............................................. 915 stbcr6.............................................. 916 tadcobra_4................................... 302 tadcobrb_4................................... 302 tadcora_4 ..................................... 302 tadcorb_4 ..................................... 302 tadcr ............................................... 299 tbter................................................ 327 tbtm ................................................. 294 tcbr .................................................. 324 tcdr.................................................. 323 tcnt .................................................. 303 tcntcmpclr .................................. 281 tcnts................................................ 322 tcr..................................................... 255
index rev. 3.00 oct. 06, 2008 page 1078 of 1080 rej09b0230-0300 tcsystr........................................... 308 tddr ................................................. 323 tder.................................................. 329 tec..................................................... 705 tgcr ................................................. 320 tgr .................................................... 303 ticcr ................................................ 295 tier ................................................... 282 tior................................................... 262 titcnt.............................................. 326 titcr................................................. 324 tmdr................................................. 259 tocr1 ............................................... 313 tocr2 ............................................... 316 toer.................................................. 312 tolbr ............................................... 319 trwer .............................................. 311 tsr..................................................... 287 tstr .................................................. 304 tsycr ............................................... 297 tsyr.................................................. 306 twcr................................................. 330 txack0 ............................................ 711 txcr0 ............................................... 710 txpr1, txpr0.................................. 708 umsr................................................. 715 wtcnt.............................................. 520 wtcsr .............................................. 521 register address table (in the order from lower addresses) ........ 954 register bit list........................................ 982 register data format.................................. 22 register states in each operating mode ..................................................... 1004 repeat transfer mode .............................. 181 reset state................................................. 47 reset-synchronized pwm mode ............ 362 risc-type ................................................. 23 s sci interrupt sources............................... 585 scsptr and sci pins ............................ 586 sending a break signal ............................ 589 sequential break...................................... 147 serial communication interface (sci)..... 527 shift instructions ....................................... 42 single chip mode ...................................... 51 single-cycle scan mode........................... 648 sleep mode ...................................... 719, 918 software protection................................. 856 software standby mode........................... 919 stack after interrupt exception handling .................................................. 116 stack states after exception handling ends ............................................ 90 status register (sr) ................................... 19 synchronous serial communication init interrupt sources ............................... 632 synchronous serial communication mode ....................................................... 615 synchronous serial communication unit .......................................................... 593 system control instructions....................... 44 t target pins and conditions for high- impedance control................................... 511 test mode settings .................................. 716 the address map for each mailbox ......... 679 the address map for the operating modes........................................................ 52 time quanta is defined............................ 695 transfer clock ......................................... 610 transfer information read skip function . 179 transfer information writeback skip function ................................................... 180
index rev. 3.00 oct. 06, 2008 page 1079 of 1080 rej09b0230-0300 trap instructions ....................................... 87 u usage notes in branch trace mode .......... 947 usage notes in ram monitor mode ....... 951 user boot mode....................................... 850 user break controller (ubc)................... 121 user break interrupt ................................ 108 user break on instruction fetch cycle...... 145 user mat............................................... 804 user program mode ................................ 839 using interval timer mode ...................... 525 using watchdog timer mode ................... 524 v vector numbers and vector table address offsets........................................................ 79 vector-base register (vbr) ...................... 20 w wait between access cycles .................... 222 watchdog time r (wdt) .......................... 517 window data trace .................................. 942
index rev. 3.00 oct. 06, 2008 page 1080 of 1080 rej09b0230-0300
renesas 32-bit risc microcomputer hardware manual sh7147 group publication date: rev.1.00, june 9, 2006 rev.3.00, october 6, 2008 published by: sales strategic planning div. renesas technology corp. edited by: customer support department global strategic communication div. renesas solutions corp. ? 2008. renesas technology corp., all rights reserved. printed in japan.
sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan http://www.renesas.com refer to " http://www.renesas.com/en/network " for the latest and detailed information. renesas technology america, inc. 450 holger way, san jose, ca 95134-1368, u.s.a tel: <1> (408) 382-7500, fax: <1> (408) 382-7501 renesas technology europe limited dukes meadow, millboard road, bourne end, buckinghamshire, sl8 5fh, u.k. tel: <44> (1628) 585-100, fax: <44> (1628) 585-900 renesas technology (shanghai) co., ltd. unit 204, 205, aziacenter, no.1233 lujiazui ring rd, pudong district, shanghai, china 200120 tel: <86> (21) 5877-1818, fax: <86> (21) 6887-7858/7898 renesas technology hong kong ltd. 7th floor, north tower, world finance centre, harbour city, canton road, tsimshatsui, kowloon, hong kong tel: <852> 2265-6688, fax: <852> 2377-3473 renesas technology taiwan co., ltd. 10th floor, no.99, fushing north road, taipei, taiwan tel: <886> (2) 2715-2888, fax: <886> (2) 3518-3399 renesas technology singapore pte. ltd. 1 harbour front avenue, #06-10, keppel bay tower, singapore 098632 tel: <65> 6213-0200, fax: <65> 6278-8001 renesas technology korea co., ltd. kukje center bldg. 18th fl., 191, 2-ka, hangang-ro, yongsan-ku, seoul 140-702, korea tel: <82> (2) 796-3115, fax: <82> (2) 796-2145 renesas technology malaysia sdn. bhd unit 906, block b, menara amcorp, amcorp trade centre, no.18, jln persiaran barat, 46050 petaling jaya, selangor darul ehsan, m alaysia tel: <603> 7955-9390, fax: <603> 7955-9510 renesas sales offices colophon 6.2

sh7147 group hardware manual


▲Up To Search▲   

 
Price & Availability of R5F7142

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X